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
## This is the API documentation for `react-native-app-auth >= 2.0.` See version `1.x` documentation [here](https://github.com/FormidableLabs/react-native-app-auth/tree/v1.0.1).
11
+
10
12
React Native bridge for [AppAuth-iOS](https://github.com/openid/AppAuth-iOS) and
11
13
[AppAuth-Android](https://github.com/openid/AppAuth-Android) SDKS for communicating with
12
14
[OAuth 2.0](https://tools.ietf.org/html/rfc6749) and
@@ -51,50 +53,81 @@ flow and returns the access token, refresh token and access token expiry date wh
51
53
throws an error when not successful.
52
54
53
55
```js
54
-
importAppAuthfrom'react-native-app-auth';
56
+
import { authorize } from'react-native-app-auth';
57
+
58
+
constbaseConfig= {
59
+
issuer:'<YOUR_ISSUER_URL>',
60
+
clientId:'<YOUR_CLIENT_ID>',
61
+
redirectUrl:'<YOUR_REDIRECT_URL>',
62
+
scopes:`<YOUR_SCOPES_ARRAY>`
63
+
};
55
64
56
-
constappAuth=newAppAuth(config);
57
-
constresult=awaitappAuth.authorize(scopes);
58
-
// returns accessToken, accessTokenExpirationDate and refreshToken
65
+
constresult=awaitauthorize(baseConfig);
59
66
```
60
67
61
-
#### `config`
68
+
#### `baseConfig`
69
+
70
+
This is your configuration object for the client. The baseConfig is passed into each of the methods
71
+
with optional overrides.
62
72
63
-
This is your configuration object for the client
64
-
-**issuer** - (`string`) *REQUIRED* the url of the auth server
65
-
-**clientId** - (`string`) *REQUIRED* your client id on the auth server
66
-
-**redirectUrl** - (`string`) *REQUIRED* the url that links back to your app with the auth code
67
-
-**additionalParameters** - (`object` | `null`) additional parameters that will be passed in the authorization request.
68
-
Must be string values! E.g. setting `additionalParameters: { hello: 'world', foo: 'bar' }` would add
69
-
`hello=world&foo=bar` to the authorization request.
73
+
***issuer** - (`string`) _REQUIRED_ the url of the auth server
74
+
***clientId** - (`string`) _REQUIRED_ your client id on the auth server
75
+
***redirectUrl** - (`string`) _REQUIRED_ the url that links back to your app with the auth code
76
+
***scopes** - (`array<string>`) _REQUIRED_ the scopes for your token, e.g. `['email', 'offline_access']`
77
+
***additionalParameters** - (`object`) additional parameters that will be passed in the authorization request.
78
+
Must be string values! E.g. setting `additionalParameters: { hello: 'world', foo: 'bar' }` would add
79
+
`hello=world&foo=bar` to the authorization request.
70
80
71
-
### `result`
81
+
####`result`
72
82
73
83
This is the result from the auth server
74
-
-**accessToken** - (`string`) the access token
75
-
-**accessTokenExpirationDate** - (`string`) the token expiration date
76
-
-**additionalParameters** - (`Object`) additional url parameters from the auth server
77
-
-**idToken** - (`string`) the id token
78
-
-**refreshToken** - (`string`) the refresh token
79
-
-**tokenType** - (`string`) the token type, e.g. Bearer
84
+
85
+
***accessToken** - (`string`) the access token
86
+
***accessTokenExpirationDate** - (`string`) the token expiration date
87
+
***additionalParameters** - (`Object`) additional url parameters from the auth server
88
+
***idToken** - (`string`) the id token
89
+
***refreshToken** - (`string`) the refresh token
90
+
***tokenType** - (`string`) the token type, e.g. Bearer
80
91
81
92
### `refresh`
82
93
83
94
This method will refresh the accessToken using the refreshToken. Some auth providers will also give
0 commit comments