1 | var __extends = (this && this.__extends) || (function () {
|
2 | var extendStatics = Object.setPrototypeOf ||
|
3 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
4 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
5 | return function (d, b) {
|
6 | extendStatics(d, b);
|
7 | function __() { this.constructor = d; }
|
8 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
9 | };
|
10 | })();
|
11 | import { isAPIResponseError } from './guards';
|
12 | import { DetailedError } from './errors';
|
13 | import { DeferredPromise } from './promise';
|
14 | import { isValidEmail } from './util';
|
15 |
|
16 |
|
17 |
|
18 | var AuthTokenContext = (function () {
|
19 | function AuthTokenContext(deps, label) {
|
20 | this.label = label;
|
21 | this.storage = deps.storage;
|
22 | }
|
23 | AuthTokenContext.prototype.get = function () {
|
24 | return this.storage.get(this.label);
|
25 | };
|
26 | AuthTokenContext.prototype.store = function (token) {
|
27 | this.storage.set(this.label, token);
|
28 | };
|
29 | AuthTokenContext.prototype.delete = function () {
|
30 | this.storage.delete(this.label);
|
31 | };
|
32 | return AuthTokenContext;
|
33 | }());
|
34 | export { AuthTokenContext };
|
35 |
|
36 |
|
37 |
|
38 | var CombinedAuthTokenContext = (function () {
|
39 | function CombinedAuthTokenContext(deps, label) {
|
40 | this.label = label;
|
41 | this.storage = deps.storage;
|
42 | this.tempStorage = deps.tempStorage;
|
43 | }
|
44 | CombinedAuthTokenContext.prototype.get = function () {
|
45 | var permToken = this.storage.get(this.label);
|
46 | var tempToken = this.tempStorage.get(this.label);
|
47 | var token = tempToken || permToken;
|
48 | return token;
|
49 | };
|
50 | CombinedAuthTokenContext.prototype.store = function (token, options) {
|
51 | if (options === void 0) { options = { 'permanent': true }; }
|
52 | if (options.permanent) {
|
53 | this.storage.set(this.label, token);
|
54 | }
|
55 | else {
|
56 | this.tempStorage.set(this.label, token);
|
57 | }
|
58 | };
|
59 | CombinedAuthTokenContext.prototype.delete = function () {
|
60 | this.storage.delete(this.label);
|
61 | this.tempStorage.delete(this.label);
|
62 | };
|
63 | return CombinedAuthTokenContext;
|
64 | }());
|
65 | export { CombinedAuthTokenContext };
|
66 |
|
67 |
|
68 |
|
69 |
|
70 |
|
71 |
|
72 | var Auth = (function () {
|
73 | function Auth(deps) {
|
74 | this.config = deps.config;
|
75 | this.emitter = deps.emitter;
|
76 | this.authModules = deps.authModules;
|
77 | this.tokenContext = deps.tokenContext;
|
78 | this.userService = deps.userService;
|
79 | this.storage = deps.storage;
|
80 | }
|
81 | Object.defineProperty(Auth.prototype, "passwordResetUrl", {
|
82 | |
83 |
|
84 |
|
85 |
|
86 |
|
87 |
|
88 |
|
89 | get: function () {
|
90 | return this.config.getURL('web') + "/password/reset/" + this.config.get('app_id');
|
91 | },
|
92 | enumerable: true,
|
93 | configurable: true
|
94 | });
|
95 | |
96 |
|
97 |
|
98 |
|
99 |
|
100 | Auth.prototype.isAuthenticated = function () {
|
101 | var token = this.tokenContext.get();
|
102 | if (token) {
|
103 | this.emitter.emit('auth:login', { token: token });
|
104 | return true;
|
105 | }
|
106 | return false;
|
107 | };
|
108 | |
109 |
|
110 |
|
111 |
|
112 |
|
113 |
|
114 |
|
115 |
|
116 |
|
117 |
|
118 |
|
119 |
|
120 |
|
121 |
|
122 | Auth.prototype.signup = function (details) {
|
123 | return this.authModules.basic.signup(details);
|
124 | };
|
125 | |
126 |
|
127 |
|
128 |
|
129 |
|
130 |
|
131 |
|
132 |
|
133 |
|
134 |
|
135 |
|
136 |
|
137 |
|
138 |
|
139 |
|
140 |
|
141 |
|
142 |
|
143 |
|
144 |
|
145 | Auth.prototype.login = function (moduleId, credentials, options) {
|
146 | var _this = this;
|
147 | if (options === void 0) { options = {}; }
|
148 | if (typeof options.remember === 'undefined') {
|
149 | options.remember = true;
|
150 | }
|
151 | if (typeof options.inAppBrowserOptions === 'undefined') {
|
152 | options.inAppBrowserOptions = {};
|
153 | }
|
154 | if (typeof options.inAppBrowserOptions.location === 'undefined') {
|
155 | options.inAppBrowserOptions.location = false;
|
156 | }
|
157 | if (typeof options.inAppBrowserOptions.clearcache === 'undefined') {
|
158 | options.inAppBrowserOptions.clearcache = true;
|
159 | }
|
160 | if (typeof options.inAppBrowserOptions.clearsessioncache === 'undefined') {
|
161 | options.inAppBrowserOptions.clearsessioncache = true;
|
162 | }
|
163 | var context = this.authModules[moduleId];
|
164 | if (!context) {
|
165 | throw new Error('Authentication class is invalid or missing:' + context);
|
166 | }
|
167 | return context.authenticate(credentials, options).then(function (r) {
|
168 | _this.storeToken(options, r.token);
|
169 | return _this.userService.load().then(function () {
|
170 | var user = _this.userService.current();
|
171 | user.store();
|
172 | return r;
|
173 | });
|
174 | });
|
175 | };
|
176 | |
177 |
|
178 |
|
179 |
|
180 |
|
181 |
|
182 | Auth.prototype.logout = function () {
|
183 | this.emitter.emit('auth:token-changed', { 'old': this.tokenContext.get(), 'new': undefined });
|
184 | this.emitter.emit('auth:logout', {});
|
185 | this.tokenContext.delete();
|
186 | var user = this.userService.current();
|
187 | user.unstore();
|
188 | user.clear();
|
189 | };
|
190 | |
191 |
|
192 |
|
193 |
|
194 |
|
195 |
|
196 |
|
197 |
|
198 |
|
199 |
|
200 | Auth.prototype.requestPasswordReset = function (email) {
|
201 | this.storage.set('auth_password_reset_email', email);
|
202 | return this.authModules.basic.requestPasswordReset(email);
|
203 | };
|
204 | |
205 |
|
206 |
|
207 |
|
208 |
|
209 |
|
210 |
|
211 |
|
212 |
|
213 | Auth.prototype.confirmPasswordReset = function (code, newPassword) {
|
214 | var email = this.storage.get('auth_password_reset_email');
|
215 | if (!email) {
|
216 | return DeferredPromise.rejectImmediately(new Error('email address not found in local storage'));
|
217 | }
|
218 | else {
|
219 | return this.authModules.basic.confirmPasswordReset(email, code, newPassword);
|
220 | }
|
221 | };
|
222 | |
223 |
|
224 |
|
225 | Auth.prototype.getToken = function () {
|
226 | return this.tokenContext.get();
|
227 | };
|
228 | |
229 |
|
230 |
|
231 | Auth.prototype.storeToken = function (options, token) {
|
232 | if (options === void 0) { options = { 'remember': true }; }
|
233 | var originalToken = this.authToken;
|
234 | this.authToken = token;
|
235 | this.tokenContext.store(this.authToken, { 'permanent': options.remember });
|
236 | this.emitter.emit('auth:token-changed', { 'old': originalToken, 'new': this.authToken });
|
237 | this.emitter.emit('auth:login', { token: this.authToken });
|
238 | };
|
239 | |
240 |
|
241 |
|
242 | Auth.getDetailedErrorFromResponse = function (res) {
|
243 | var errors = [];
|
244 | var details = [];
|
245 | if (isAPIResponseError(res.body) && typeof res.body.error.details !== 'undefined') {
|
246 | details = res.body.error.details;
|
247 | }
|
248 | for (var i = 0; i < details.length; i++) {
|
249 | var detail = details[i];
|
250 | if (detail.error_type) {
|
251 | errors.push(detail.error_type + '_' + detail.parameter);
|
252 | }
|
253 | }
|
254 | return new DetailedError('Error creating user', errors);
|
255 | };
|
256 | return Auth;
|
257 | }());
|
258 | export { Auth };
|
259 |
|
260 |
|
261 |
|
262 | var AuthType = (function () {
|
263 | function AuthType(deps) {
|
264 | this.config = deps.config;
|
265 | this.client = deps.client;
|
266 | this.emitter = deps.emitter;
|
267 | }
|
268 | AuthType.prototype.parseInAppBrowserOptions = function (opts) {
|
269 | if (!opts) {
|
270 | return '';
|
271 | }
|
272 | var p = [];
|
273 | for (var k in opts) {
|
274 | var v = void 0;
|
275 | if (typeof opts[k] === 'boolean') {
|
276 | v = opts[k] ? 'yes' : 'no';
|
277 | }
|
278 | else {
|
279 | v = opts[k];
|
280 | }
|
281 | p.push(k + "=" + v);
|
282 | }
|
283 | return p.join(',');
|
284 | };
|
285 | AuthType.prototype.inAppBrowserFlow = function (moduleId, data, options) {
|
286 | var _this = this;
|
287 | if (data === void 0) { data = {}; }
|
288 | if (options === void 0) { options = {}; }
|
289 | var deferred = new DeferredPromise();
|
290 | if (!window || !window.cordova) {
|
291 | return deferred.reject(new Error('Cordova is missing--can\'t login with InAppBrowser flow.'));
|
292 | }
|
293 | this.emitter.once('cordova:deviceready', function () {
|
294 | if (!window.cordova.InAppBrowser) {
|
295 | deferred.reject(new Error('InAppBrowser plugin missing'));
|
296 | return;
|
297 | }
|
298 | _this.client.post("/auth/login/" + moduleId)
|
299 | .send({
|
300 | 'app_id': _this.config.get('app_id'),
|
301 | 'callback': window.location.href,
|
302 | 'data': data
|
303 | })
|
304 | .end(function (err, res) {
|
305 | if (err) {
|
306 | deferred.reject(err);
|
307 | }
|
308 | else {
|
309 | var w_1 = window.cordova.InAppBrowser.open(res.body.data.url, '_blank', _this.parseInAppBrowserOptions(options.inAppBrowserOptions));
|
310 | var onExit_1 = function () {
|
311 | deferred.reject(new Error('InAppBrowser exit'));
|
312 | };
|
313 | var onLoadError_1 = function () {
|
314 | deferred.reject(new Error('InAppBrowser loaderror'));
|
315 | };
|
316 | var onLoadStart = function (data) {
|
317 | if (data.url.slice(0, 20) === 'http://auth.ionic.io') {
|
318 | var queryString = data.url.split('#')[0].split('?')[1];
|
319 | var paramParts = queryString.split('&');
|
320 | var params = {};
|
321 | for (var i = 0; i < paramParts.length; i++) {
|
322 | var part = paramParts[i].split('=');
|
323 | params[part[0]] = part[1];
|
324 | }
|
325 | w_1.removeEventListener('exit', onExit_1);
|
326 | w_1.removeEventListener('loaderror', onLoadError_1);
|
327 | w_1.close();
|
328 | if (params['error']) {
|
329 | deferred.reject(new Error(decodeURIComponent(params['error'])));
|
330 | }
|
331 | else {
|
332 | deferred.resolve({
|
333 | 'token': params['token'],
|
334 | 'signup': Boolean(parseInt(params['signup'], 10))
|
335 | });
|
336 | }
|
337 | }
|
338 | };
|
339 | w_1.addEventListener('exit', onExit_1);
|
340 | w_1.addEventListener('loaderror', onLoadError_1);
|
341 | w_1.addEventListener('loadstart', onLoadStart);
|
342 | }
|
343 | });
|
344 | });
|
345 | return deferred.promise;
|
346 | };
|
347 | return AuthType;
|
348 | }());
|
349 | export { AuthType };
|
350 |
|
351 |
|
352 |
|
353 | var BasicAuthType = (function (_super) {
|
354 | __extends(BasicAuthType, _super);
|
355 | function BasicAuthType() {
|
356 | return _super !== null && _super.apply(this, arguments) || this;
|
357 | }
|
358 | BasicAuthType.prototype.authenticate = function (data, options) {
|
359 | var deferred = new DeferredPromise();
|
360 | if (!data.email || !data.password) {
|
361 | return deferred.reject(new Error('email and password are required for basic authentication'));
|
362 | }
|
363 | this.client.post('/auth/login')
|
364 | .send({
|
365 | 'app_id': this.config.get('app_id'),
|
366 | 'email': data.email,
|
367 | 'password': data.password
|
368 | })
|
369 | .end(function (err, res) {
|
370 | if (err) {
|
371 | deferred.reject(err);
|
372 | }
|
373 | else {
|
374 | deferred.resolve({
|
375 | 'token': res.body.data.token
|
376 | });
|
377 | }
|
378 | });
|
379 | return deferred.promise;
|
380 | };
|
381 | BasicAuthType.prototype.requestPasswordReset = function (email) {
|
382 | var deferred = new DeferredPromise();
|
383 | if (!email) {
|
384 | return deferred.reject(new Error('Email is required for password reset request.'));
|
385 | }
|
386 | this.client.post('/auth/users/password/reset')
|
387 | .send({
|
388 | 'app_id': this.config.get('app_id'),
|
389 | 'email': email,
|
390 | 'flow': 'app'
|
391 | })
|
392 | .end(function (err, res) {
|
393 | if (err) {
|
394 | deferred.reject(err);
|
395 | }
|
396 | else {
|
397 | deferred.resolve();
|
398 | }
|
399 | });
|
400 | return deferred.promise;
|
401 | };
|
402 | BasicAuthType.prototype.confirmPasswordReset = function (email, code, newPassword) {
|
403 | var deferred = new DeferredPromise();
|
404 | if (!code || !email || !newPassword) {
|
405 | return deferred.reject(new Error('Code, new password, and email are required.'));
|
406 | }
|
407 | this.client.post('/auth/users/password')
|
408 | .send({
|
409 | 'reset_token': code,
|
410 | 'new_password': newPassword,
|
411 | 'email': email
|
412 | })
|
413 | .end(function (err, res) {
|
414 | if (err) {
|
415 | deferred.reject(err);
|
416 | }
|
417 | else {
|
418 | deferred.resolve();
|
419 | }
|
420 | });
|
421 | return deferred.promise;
|
422 | };
|
423 | BasicAuthType.prototype.signup = function (data) {
|
424 | var deferred = new DeferredPromise();
|
425 | if (data.email) {
|
426 | if (!isValidEmail(data.email)) {
|
427 | return deferred.reject(new DetailedError('Invalid email supplied.', ['invalid_email']));
|
428 | }
|
429 | }
|
430 | else {
|
431 | return deferred.reject(new DetailedError('Email is required for email/password auth signup.', ['required_email']));
|
432 | }
|
433 | if (!data.password) {
|
434 | return deferred.reject(new DetailedError('Password is required for email/password auth signup.', ['required_password']));
|
435 | }
|
436 | var userData = {
|
437 | 'app_id': this.config.get('app_id'),
|
438 | 'email': data.email,
|
439 | 'password': data.password
|
440 | };
|
441 |
|
442 | if (data.username) {
|
443 | userData.username = data.username;
|
444 | }
|
445 | if (data.image) {
|
446 | userData.image = data.image;
|
447 | }
|
448 | if (data.name) {
|
449 | userData.name = data.name;
|
450 | }
|
451 | if (data.custom) {
|
452 | userData.custom = data.custom;
|
453 | }
|
454 | this.client.post('/auth/users')
|
455 | .send(userData)
|
456 | .end(function (err, res) {
|
457 | if (err) {
|
458 | deferred.reject(Auth.getDetailedErrorFromResponse(err.response));
|
459 | }
|
460 | else {
|
461 | deferred.resolve();
|
462 | }
|
463 | });
|
464 | return deferred.promise;
|
465 | };
|
466 | return BasicAuthType;
|
467 | }(AuthType));
|
468 | export { BasicAuthType };
|
469 |
|
470 |
|
471 |
|
472 | var NativeAuth = (function () {
|
473 | function NativeAuth(deps) {
|
474 | this.config = deps.config;
|
475 | this.client = deps.client;
|
476 | this.userService = deps.userService;
|
477 | this.tokenContext = deps.tokenContext;
|
478 | this.emitter = deps.emitter;
|
479 | }
|
480 | |
481 |
|
482 |
|
483 |
|
484 | NativeAuth.prototype.getToken = function () {
|
485 | return this.tokenContext.get();
|
486 | };
|
487 | |
488 |
|
489 |
|
490 | NativeAuth.prototype.storeToken = function (token) {
|
491 | var originalToken = this.authToken;
|
492 | this.authToken = token;
|
493 | this.tokenContext.store(this.authToken, { 'permanent': true });
|
494 | this.emitter.emit('auth:token-changed', { 'old': originalToken, 'new': this.authToken });
|
495 | this.emitter.emit('auth:login', { token: this.authToken });
|
496 | };
|
497 | return NativeAuth;
|
498 | }());
|
499 | export { NativeAuth };
|
500 |
|
501 |
|
502 |
|
503 |
|
504 | var GoogleAuth = (function (_super) {
|
505 | __extends(GoogleAuth, _super);
|
506 | function GoogleAuth() {
|
507 | return _super !== null && _super.apply(this, arguments) || this;
|
508 | }
|
509 | GoogleAuth.prototype.logout = function () {
|
510 | var deferred = new DeferredPromise();
|
511 | this.emitter.emit('auth:token-changed', { 'old': this.tokenContext.get(), 'new': undefined });
|
512 | this.emitter.emit('auth:logout', {});
|
513 | this.tokenContext.delete();
|
514 | var user = this.userService.current();
|
515 | user.unstore();
|
516 | user.clear();
|
517 | window.plugins.googleplus.logout(function () {
|
518 | deferred.resolve();
|
519 | }, function (err) {
|
520 | deferred.reject(err);
|
521 | });
|
522 | return deferred.promise;
|
523 | };
|
524 | GoogleAuth.prototype.login = function () {
|
525 | var _this = this;
|
526 | var deferred = new DeferredPromise();
|
527 | var authConfig = this.config.settings.auth;
|
528 | this.emitter.once('cordova:deviceready', function () {
|
529 | var scope = ['profile', 'email'];
|
530 | if (!window || !window.cordova) {
|
531 | deferred.reject(new Error('Cordova is missing'));
|
532 | return;
|
533 | }
|
534 | if (!window.plugins || !window.plugins.googleplus) {
|
535 | deferred.reject(new Error('GooglePlus cordova plugin is missing. Install the plugin by following the instructions here: https://github.com/EddyVerbruggen/cordova-plugin-googleplus'));
|
536 | return;
|
537 | }
|
538 | if (!authConfig || !authConfig.google || !authConfig.google.webClientId) {
|
539 | deferred.reject(new Error('Missing google web client id. Please visit http://docs.ionic.io/services/users/google-auth.html#native'));
|
540 | return;
|
541 | }
|
542 | if (authConfig.google.scope) {
|
543 | authConfig.google.scope.forEach(function (item) {
|
544 | if (scope.indexOf(item) === -1) {
|
545 | scope.push(item);
|
546 | }
|
547 | });
|
548 | }
|
549 | window.plugins.googleplus.login({ 'webClientId': authConfig.google.webClientId, 'offline': true, 'scopes': scope.join(' ') }, function (success) {
|
550 | if (!success.serverAuthCode) {
|
551 | deferred.reject(new Error('Failed to retrieve offline access token.'));
|
552 | return;
|
553 | }
|
554 | var request_object = {
|
555 | 'app_id': _this.config.get('app_id'),
|
556 | 'serverAuthCode': success.serverAuthCode,
|
557 | 'additional_fields': scope,
|
558 | 'flow': 'native-mobile'
|
559 | };
|
560 | _this.client.post('/auth/login/google')
|
561 | .send(request_object)
|
562 | .end(function (err, res) {
|
563 | if (err) {
|
564 | deferred.reject(err);
|
565 | }
|
566 | else {
|
567 | _this.storeToken(res.body.data.token);
|
568 | _this.userService.load().then(function () {
|
569 | var user = _this.userService.current();
|
570 | user.store();
|
571 | deferred.resolve({
|
572 | 'token': res.body.data.token,
|
573 | 'signup': Boolean(parseInt(res.body.data.signup, 10))
|
574 | });
|
575 | });
|
576 | }
|
577 | });
|
578 | }, function (err) {
|
579 | deferred.reject(err);
|
580 | });
|
581 | });
|
582 | return deferred.promise;
|
583 | };
|
584 | return GoogleAuth;
|
585 | }(NativeAuth));
|
586 | export { GoogleAuth };
|
587 |
|
588 |
|
589 |
|
590 |
|
591 | var FacebookAuth = (function (_super) {
|
592 | __extends(FacebookAuth, _super);
|
593 | function FacebookAuth() {
|
594 | return _super !== null && _super.apply(this, arguments) || this;
|
595 | }
|
596 | FacebookAuth.prototype.logout = function () {
|
597 | var deferred = new DeferredPromise();
|
598 | this.emitter.emit('auth:token-changed', { 'old': this.tokenContext.get(), 'new': undefined });
|
599 | this.emitter.emit('auth:logout', {});
|
600 | this.tokenContext.delete();
|
601 | var user = this.userService.current();
|
602 | user.unstore();
|
603 | user.clear();
|
604 |
|
605 | window.facebookConnectPlugin.logout(function () {
|
606 | deferred.resolve();
|
607 | }, function (err) {
|
608 | deferred.reject(err);
|
609 | });
|
610 | return deferred.promise;
|
611 | };
|
612 | FacebookAuth.prototype.login = function () {
|
613 | var _this = this;
|
614 | var deferred = new DeferredPromise();
|
615 | var authConfig = this.config.settings.auth;
|
616 | var scope = ['public_profile', 'email'];
|
617 | if (authConfig && authConfig.facebook && authConfig.facebook.scope) {
|
618 | authConfig.facebook.scope.forEach(function (item) {
|
619 | if (scope.indexOf(item) === -1) {
|
620 | scope.push(item);
|
621 | }
|
622 | });
|
623 | }
|
624 | this.emitter.once('cordova:deviceready', function () {
|
625 | if (!window || !window.cordova) {
|
626 | deferred.reject(new Error('Cordova is missing.'));
|
627 | return;
|
628 | }
|
629 | if (!window.facebookConnectPlugin) {
|
630 | deferred.reject(new Error('Please install the cordova-plugin-facebook4 plugin'));
|
631 | return;
|
632 | }
|
633 | window.facebookConnectPlugin.login(scope, function (r) {
|
634 | scope.splice(scope.indexOf('public_profile'), 1);
|
635 | var request_object = {
|
636 | 'app_id': _this.config.get('app_id'),
|
637 | 'access_token': r.authResponse.accessToken,
|
638 | 'additional_fields': scope,
|
639 | 'flow': 'native-mobile'
|
640 | };
|
641 | _this.client.post('/auth/login/facebook')
|
642 | .send(request_object)
|
643 | .end(function (err, res) {
|
644 | if (err) {
|
645 | deferred.reject(err);
|
646 | }
|
647 | else {
|
648 | _this.storeToken(res.body.data.token);
|
649 | _this.userService.load().then(function () {
|
650 | var user = _this.userService.current();
|
651 | user.store();
|
652 | deferred.resolve({
|
653 | 'token': res.body.data.token,
|
654 | 'signup': Boolean(parseInt(res.body.data.signup, 10))
|
655 | });
|
656 | });
|
657 | }
|
658 | });
|
659 | }, function (err) {
|
660 | deferred.reject(err);
|
661 | });
|
662 | });
|
663 | return deferred.promise;
|
664 | };
|
665 | return FacebookAuth;
|
666 | }(NativeAuth));
|
667 | export { FacebookAuth };
|
668 |
|
669 |
|
670 |
|
671 | var CustomAuthType = (function (_super) {
|
672 | __extends(CustomAuthType, _super);
|
673 | function CustomAuthType() {
|
674 | return _super !== null && _super.apply(this, arguments) || this;
|
675 | }
|
676 | CustomAuthType.prototype.authenticate = function (data, options) {
|
677 | if (data === void 0) { data = {}; }
|
678 | return this.inAppBrowserFlow('custom', data, options);
|
679 | };
|
680 | return CustomAuthType;
|
681 | }(AuthType));
|
682 | export { CustomAuthType };
|
683 |
|
684 |
|
685 |
|
686 | var TwitterAuthType = (function (_super) {
|
687 | __extends(TwitterAuthType, _super);
|
688 | function TwitterAuthType() {
|
689 | return _super !== null && _super.apply(this, arguments) || this;
|
690 | }
|
691 | TwitterAuthType.prototype.authenticate = function (data, options) {
|
692 | if (data === void 0) { data = {}; }
|
693 | return this.inAppBrowserFlow('twitter', data, options);
|
694 | };
|
695 | return TwitterAuthType;
|
696 | }(AuthType));
|
697 | export { TwitterAuthType };
|
698 |
|
699 |
|
700 |
|
701 | var FacebookAuthType = (function (_super) {
|
702 | __extends(FacebookAuthType, _super);
|
703 | function FacebookAuthType() {
|
704 | return _super !== null && _super.apply(this, arguments) || this;
|
705 | }
|
706 | FacebookAuthType.prototype.authenticate = function (data, options) {
|
707 | if (data === void 0) { data = {}; }
|
708 | return this.inAppBrowserFlow('facebook', data, options);
|
709 | };
|
710 | return FacebookAuthType;
|
711 | }(AuthType));
|
712 | export { FacebookAuthType };
|
713 |
|
714 |
|
715 |
|
716 | var GithubAuthType = (function (_super) {
|
717 | __extends(GithubAuthType, _super);
|
718 | function GithubAuthType() {
|
719 | return _super !== null && _super.apply(this, arguments) || this;
|
720 | }
|
721 | GithubAuthType.prototype.authenticate = function (data, options) {
|
722 | if (data === void 0) { data = {}; }
|
723 | return this.inAppBrowserFlow('github', data, options);
|
724 | };
|
725 | return GithubAuthType;
|
726 | }(AuthType));
|
727 | export { GithubAuthType };
|
728 |
|
729 |
|
730 |
|
731 | var GoogleAuthType = (function (_super) {
|
732 | __extends(GoogleAuthType, _super);
|
733 | function GoogleAuthType() {
|
734 | return _super !== null && _super.apply(this, arguments) || this;
|
735 | }
|
736 | GoogleAuthType.prototype.authenticate = function (data, options) {
|
737 | if (data === void 0) { data = {}; }
|
738 | return this.inAppBrowserFlow('google', data, options);
|
739 | };
|
740 | return GoogleAuthType;
|
741 | }(AuthType));
|
742 | export { GoogleAuthType };
|
743 |
|
744 |
|
745 |
|
746 | var InstagramAuthType = (function (_super) {
|
747 | __extends(InstagramAuthType, _super);
|
748 | function InstagramAuthType() {
|
749 | return _super !== null && _super.apply(this, arguments) || this;
|
750 | }
|
751 | InstagramAuthType.prototype.authenticate = function (data, options) {
|
752 | if (data === void 0) { data = {}; }
|
753 | return this.inAppBrowserFlow('instagram', data, options);
|
754 | };
|
755 | return InstagramAuthType;
|
756 | }(AuthType));
|
757 | export { InstagramAuthType };
|
758 |
|
759 |
|
760 |
|
761 | var LinkedInAuthType = (function (_super) {
|
762 | __extends(LinkedInAuthType, _super);
|
763 | function LinkedInAuthType() {
|
764 | return _super !== null && _super.apply(this, arguments) || this;
|
765 | }
|
766 | LinkedInAuthType.prototype.authenticate = function (data, options) {
|
767 | if (data === void 0) { data = {}; }
|
768 | return this.inAppBrowserFlow('linkedin', data, options);
|
769 | };
|
770 | return LinkedInAuthType;
|
771 | }(AuthType));
|
772 | export { LinkedInAuthType };
|