You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+21-15
Original file line number
Diff line number
Diff line change
@@ -1,33 +1,41 @@
1
-
# react-native-app-auth
1
+
# React Native App Auth
2
2
3
3
React Native bridge for  and  - an SDK for communicating with OAuth2 providers. It also supports the PKCE extension to OAuth.
4
4
5
-
In theory, the library should support any OAuth provider that implements the and it has been tested with:
5
+
This library *should* support any OAuth provider that implements the but it has only been tested with:
The library uses auto-discovery which mean it relies on the the  endpoint to discover all auth endpoints automatically. It will be possible to extend the library later to add custom configuration.
11
11
12
-
### authorize()
12
+
# Supported methods:
13
+
14
+
### authorize
15
+
This is the main function to use for authentication. Evoking this function will do the whole login flow and returns the access token, refresh token and access token expiry date when successful, or it throws an error when not successful.
13
16
```
14
-
await AppAuth.authorize(scopes);
17
+
import AppAuth from 'react-native-app-auth';
18
+
19
+
const appAuth = new AppAuth(config);
20
+
const result = await AppAuth.authorize(scopes);
15
21
// returns accessToken, accessTokenExpirationDate and refreshToken
16
22
```
17
23
18
-
### refresh()
24
+
### refresh
25
+
This method will refresh the accessToken using the refreshToken. Some auth providers will also give you a new refreshToken
19
26
```
20
27
await AppAuth.refresh(refreshToken, scopes);
21
-
// returns accessTokenExpirationDate
28
+
// returns accessToken, accessTokenExpirationDate and (maybe) refreshToken
22
29
```
23
30
24
-
### revokeToken()
31
+
### revokeToken
32
+
This method will revoke a token. The tokenToRevoke can be either an accessToken or a refreshToken
25
33
```
26
34
// note, sendClientId=true will only be required when using IdentityServer
0 commit comments