Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions src/interfaces/AuthProvider.js
Original file line number Diff line number Diff line change
@@ -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,
}