Skip to content

Commit c88d0aa

Browse files
author
Kadi Kraman
authored
Merge branch 'master' into fix/revoke-authorization
2 parents 8263452 + 85ce7d2 commit c88d0aa

File tree

13 files changed

+793
-86
lines changed

13 files changed

+793
-86
lines changed

.eslintrc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,8 @@ rules:
2424
prettier/prettier:
2525
- error
2626
- trailingComma: es5
27+
eqeqeq:
28+
- error
29+
- smart
30+
max-statements:
31+
- off

.github/workflows/main.yml

Lines changed: 0 additions & 31 deletions
This file was deleted.

.travis.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
notifications:
2+
email: false
3+
4+
branches:
5+
only:
6+
- master
7+
- /^v\d+\.\d+\.\d+/
8+
9+
language: node_js
10+
cache:
11+
yarn: true
12+
node_js:
13+
- '10'
14+
15+
matrix:
16+
fast_finish: true
17+
18+
install:
19+
- yarn install --frozen-lockfile --non-interactive
20+
21+
jobs:
22+
include:
23+
- stage: Lint
24+
script:
25+
- yarn run lint
26+
27+
- stage: Test
28+
script:
29+
- yarn run test

README.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ with optional overrides.
123123
* **customHeaders** - (`object`) _ANDROID_ you can specify custom headers to pass during authorize request and/or token request.
124124
* **authorize** - (`{ [key: string]: value }`) headers to be passed during authorization request.
125125
* **token** - (`{ [key: string]: value }`) headers to be passed during token retrieval request.
126+
* **register** - (`{ [key: string]: value }`) headers to be passed during registration request.
126127
* **useNonce** - (`boolean`) _IOS_ (default: true) optionally allows not sending the nonce parameter, to support non-compliant providers
127128
* **usePKCE** - (`boolean`) (default: true) optionally allows not sending the code_challenge parameter and skipping PKCE code verification, to support non-compliant providers.
128129

@@ -179,6 +180,49 @@ const result = await revoke(config, {
179180
});
180181
```
181182

183+
184+
### `register`
185+
186+
This will perform [dynamic client registration](https://openid.net/specs/openid-connect-registration-1_0.html) on the given provider.
187+
If the provider supports dynamic client registration, it will generate a `clientId` for you to use in subsequent calls to this library.
188+
189+
```js
190+
import { register } from 'react-native-app-auth';
191+
192+
const registerConfig = {
193+
issuer: '<YOUR_ISSUER_URL>',
194+
redirectUrls: ['<YOUR_REDIRECT_URL>', '<YOUR_OTHER_REDIRECT_URL>'],
195+
};
196+
197+
const registerResult = await register(registerConfig);
198+
```
199+
200+
#### registerConfig
201+
202+
* **issuer** - (`string`) same as in authorization config
203+
* **serviceConfiguration** - (`object`) same as in authorization config
204+
* **redirectUrls** - (`array<string>`) _REQUIRED_ specifies all of the redirect urls that your client will use for authentication
205+
* **responseTypes** - (`array<string>`) an array that specifies which [OAuth 2.0 response types](https://openid.net/specs/oauth-v2-multiple-response-types-1_0.html) your client will use. The default value is `['code']`
206+
* **grantTypes** - (`array<string>`) an array that specifies which [OAuth 2.0 grant types](https://oauth.net/2/grant-types/) your client will use. The default value is `['authorization_code']`
207+
* **subjectType** - (`string`) requests a specific [subject type](https://openid.net/specs/openid-connect-core-1_0.html#SubjectIDTypes) for your client
208+
* **tokenEndpointAuthMethod** (`string`) specifies which `clientAuthMethod` your client will use for authentication. The default value is `'client_secret_basic'`
209+
* **additionalParameters** - (`object`) additional parameters that will be passed in the registration request.
210+
Must be string values! E.g. setting `additionalParameters: { hello: 'world', foo: 'bar' }` would add
211+
`hello=world&foo=bar` to the authorization request.
212+
* **dangerouslyAllowInsecureHttpRequests** - (`boolean`) _ANDROID_ same as in authorization config
213+
* **customHeaders** - (`object`) _ANDROID_ same as in authorization config
214+
215+
#### registerResult
216+
217+
This is the result from the auth server
218+
219+
* **clientId** - (`string`) the assigned client id
220+
* **clientIdIssuedAt** - (`string`) _OPTIONAL_ date string of when the client id was issued
221+
* **clientSecret** - (`string`) _OPTIONAL_ the assigned client secret
222+
* **clientSecretExpiresAt** - (`string`) date string of when the client secret expires, which will be provided if `clientSecret` is provided. If `new Date(clientSecretExpiresAt).getTime() === 0`, then the secret never expires
223+
* **registrationClientUri** - (`string`) _OPTIONAL_ uri that can be used to perform subsequent operations on the registration
224+
* **registrationAccessToken** - (`string`) token that can be used at the endpoint given by `registrationClientUri` to perform subsequent operations on the registration. Will be provided if `registrationClientUri` is provided
225+
182226
## Getting started
183227

184228
```sh

0 commit comments

Comments
 (0)