Skip to content

Commit 1fe021b

Browse files
authored
Authentication Provider Interface (#802)
To be used JS Documentation
1 parent 1d30b03 commit 1fe021b

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

src/interfaces/AuthProvider.js

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
/**
2+
* Copyright (c) 2015-present, Parse, LLC.
3+
* All rights reserved.
4+
*
5+
* This source code is licensed under the BSD-style license found in the
6+
* LICENSE file in the root directory of this source tree. An additional grant
7+
* of patent rights can be found in the PATENTS file in the same directory.
8+
* @flow
9+
*/
10+
11+
/**
12+
* Interface declaration for Authentication Providers
13+
*/
14+
export interface AuthProvider {
15+
/**
16+
* Called when _linkWith isn't passed authData.
17+
* Handle your own authentication here.
18+
*
19+
* @params {Object} options.success(provider, authData) or options.error(provider, error) on completion
20+
*/
21+
authenticate(options: any): void,
22+
23+
/**
24+
* (Optional) Called when service is unlinked.
25+
* Handle any cleanup here.
26+
*/
27+
deauthenticate(): void,
28+
29+
/**
30+
* Unique identifier for this Auth Provider.
31+
*
32+
* @return {String} identifier
33+
*/
34+
getAuthType(): string,
35+
36+
/**
37+
* Called when auth data is syncronized.
38+
* Can be used to determine if authData is still valid
39+
40+
* @params {Object} authData Data used when register provider
41+
* @return {Boolean} Indicate if service should continue to be linked
42+
*/
43+
restoreAuthentication(authData: any): boolean,
44+
}

0 commit comments

Comments
 (0)