From da97b656495303efc50a563b95908b738ef776a4 Mon Sep 17 00:00:00 2001 From: Diamond Lewis Date: Tue, 23 Apr 2019 22:20:03 -0500 Subject: [PATCH] Authentication Provider Interface To be used JS Documentation --- src/interfaces/AuthProvider.js | 44 ++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 src/interfaces/AuthProvider.js diff --git a/src/interfaces/AuthProvider.js b/src/interfaces/AuthProvider.js new file mode 100644 index 000000000..433063aaa --- /dev/null +++ b/src/interfaces/AuthProvider.js @@ -0,0 +1,44 @@ +/** + * Copyright (c) 2015-present, Parse, LLC. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * @flow + */ + +/** + * Interface declaration for Authentication Providers + */ +export interface AuthProvider { + /** + * Called when _linkWith isn't passed authData. + * Handle your own authentication here. + * + * @params {Object} options.success(provider, authData) or options.error(provider, error) on completion + */ + authenticate(options: any): void, + + /** + * (Optional) Called when service is unlinked. + * Handle any cleanup here. + */ + deauthenticate(): void, + + /** + * Unique identifier for this Auth Provider. + * + * @return {String} identifier + */ + getAuthType(): string, + + /** + * Called when auth data is syncronized. + * Can be used to determine if authData is still valid + + * @params {Object} authData Data used when register provider + * @return {Boolean} Indicate if service should continue to be linked + */ + restoreAuthentication(authData: any): boolean, +}