Skip to content

Commit ca39312

Browse files
RNAA Docusaurus v1 site (#981)
Co-authored-by: Charlie Brown <carbonrobot@gmail.com>
1 parent 3ea0060 commit ca39312

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+9670
-61
lines changed

.eslintignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
Example
1+
Example
2+
docs/docusaurus.config.ts

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<a href="https://formidable.com/open-source/" target="_blank">
2-
<img alt="React Native App Auth — Formidable, We build the modern web" src="https://raw.githubusercontent.com/FormidableLabs/react-native-app-auth/main/react-native-app-auth-Hero.png" />
2+
<img alt="React Native App Auth — Formidable, We build the modern web" src="https://oss.nearform.com/api/banner?text=react+native+app+auth" />
33
</a>
44
<p align="center">
55
<strong>React native bridge for AppAuth - an SDK for communicating with OAuth2 providers</strong>
@@ -124,7 +124,7 @@ with optional overrides.
124124
- **registrationEndpoint** - (`string`) fully formed url to your OAuth/OpenID Connect registration endpoint. Only necessary for servers that require client registration.
125125
- **endSessionEndpoint** - (`string`) fully formed url to your OpenID Connect end session endpoint. If you want to be able to end a user's session and no `issuer` is specified, this field is mandatory.
126126
- **clientId** - (`string`) _REQUIRED_ your client id on the auth server
127-
- **clientSecret** - (`string`) client secret to pass to token exchange requests. :warning: Read more about [client secrets](#note-about-client-secrets)
127+
- **clientSecret** - (`string`) client secret to pass to token exchange requests. :warning: Read more about [client secrets](/docs/client-secrets)
128128
- **redirectUrl** - (`string`) _REQUIRED_ the url that links back to your app with the auth code
129129
- **scopes** - (`array<string>`) the scopes for your token, e.g. `['email', 'offline_access']`.
130130
- **additionalParameters** - (`object`) additional parameters that will be passed in the authorization request.
@@ -548,6 +548,6 @@ Please see our [contributing guide](./.github/CONTRIBUTING.md).
548548
549549
## Maintenance Status
550550
551-
**Active:** Formidable is actively working on this project, and we expect to continue for work for the foreseeable future. Bug reports, feature requests and pull requests are welcome.
551+
**Active:** Nearform is actively working on this project, and we expect to continue for work for the foreseeable future. Bug reports, feature requests and pull requests are welcome.
552552
553553
[maintenance-image]: https://img.shields.io/badge/maintenance-active-green.svg

docs/.gitignore

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Dependencies
2+
/node_modules
3+
4+
# Production
5+
/build
6+
7+
# Generated files
8+
.docusaurus
9+
.cache-loader
10+
11+
# Misc
12+
.DS_Store
13+
.env.local
14+
.env.development.local
15+
.env.test.local
16+
.env.production.local
17+
18+
npm-debug.log*
19+
yarn-debug.log*
20+
yarn-error.log*

docs/README.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Website
2+
3+
This website is built using [Docusaurus](https://docusaurus.io/), a modern static website generator.
4+
5+
### Installation
6+
7+
```
8+
$ yarn
9+
```
10+
11+
### Local Development
12+
13+
```
14+
$ yarn start
15+
```
16+
17+
This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server.
18+
19+
### Build
20+
21+
```
22+
$ yarn build
23+
```
24+
25+
This command generates static content into the `build` directory and can be served using any static contents hosting service.
26+
27+
### Deployment
28+
29+
This site is deployed using Vercel, which will automatically detect the site config and deploy

docs/babel.config.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module.exports = {
2+
presets: [require.resolve('@docusaurus/core/lib/babel/preset')],
3+
};

docs/docs/client-secrets.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
sidebar_position: 2
3+
---
4+
5+
# Client Secrets
6+
7+
Some authentication providers, including examples cited below, require you to provide a client secret. The authors of the AppAuth library
8+
9+
> [strongly recommend](https://github.com/openid/AppAuth-Android#utilizing-client-secrets-dangerous) you avoid using static client secrets in your native applications whenever possible. Client secrets derived via a dynamic client registration are safe to use, but static client secrets can be easily extracted from your apps and allow others to impersonate your app and steal user data. If client secrets must be used by the OAuth2 provider you are integrating with, we strongly recommend performing the code exchange step on your backend, where the client secret can be kept hidden.
10+
11+
Having said this, in some cases using client secrets is unavoidable. In these cases, a `clientSecret` parameter can be provided to `authorize`/`refresh` calls when performing a token request.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"label": "Config Examples",
3+
"position": 3,
4+
"link": {
5+
"type": "generated-index"
6+
}
7+
}

docs/config-examples/asgardeo.md renamed to docs/docs/config-examples/asgardeo.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# Asgardeo
2+
13
To add authentication to your app using Asgardeo, you will first need to [create an application](https://wso2.com/asgardeo/docs/guides/applications/register-mobile-app/) in the Asgardeo console. If you don't have an Asgardeo account, [you can signup for one free](https://asgardeo.io/signup).
24

35
After creating an application, take note of the configuration values listed in the **Quick Start** and **Info** tabs. You will be using those values as follows.
@@ -7,7 +9,7 @@ export const config = {
79
issuer: 'https://api.asgardeo.io/t/<your_org_name>/oauth2/token',
810
clientId: '<your_application_id>',
911
redirectUrl: '<your_appAuthRedirectScheme>://example',
10-
scopes: ['openid', 'profile']
12+
scopes: ['openid', 'profile'],
1113
};
1214

1315
// Log in to get an authentication token
@@ -20,12 +22,12 @@ const refreshedState = await refresh(config, {
2022

2123
// Revoke token
2224
await revoke(config, {
23-
tokenToRevoke: refreshedState.refreshToken
25+
tokenToRevoke: refreshedState.refreshToken,
2426
});
2527

2628
// End session
2729
await logout(config, {
2830
idToken: authState.idToken,
29-
postLogoutRedirectUrl: '<your_appAuthRedirectScheme>:/logout'
31+
postLogoutRedirectUrl: '<your_appAuthRedirectScheme>:/logout',
3032
});
3133
```

docs/config-examples/aws-cognito.md renamed to docs/docs/config-examples/aws-cognito.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ const config = {
1818
serviceConfiguration: {
1919
authorizationEndpoint: '<YOUR_DOMAIN_NAME>/oauth2/authorize',
2020
tokenEndpoint: '<YOUR_DOMAIN_NAME>/oauth2/token',
21-
revocationEndpoint: '<YOUR_DOMAIN_NAME>/oauth2/revoke'
22-
}
21+
revocationEndpoint: '<YOUR_DOMAIN_NAME>/oauth2/revoke',
22+
},
2323
};
2424

2525
// Log in to get an authentication token
@@ -32,6 +32,6 @@ const refreshedState = await refresh(config, {
3232

3333
// Revoke token
3434
await revoke(config, {
35-
tokenToRevoke: refreshedState.refreshToken
35+
tokenToRevoke: refreshedState.refreshToken,
3636
});
3737
```

docs/config-examples/azure-active-directory-b2c.md renamed to docs/docs/config-examples/azure-active-directory-b2c.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## Azure Active Directory B2C
1+
# Azure Active Directory B2C
22

33
Detailed documentation [here](https://docs.microsoft.com/en-us/azure/active-directory-b2c/openid-connect).
44

@@ -7,7 +7,7 @@ const config = {
77
issuer: 'https://<TENANT_NAME>.b2clogin.com/<TENANT_NAME>.onmicrosoft.com/<USER_FLOW_NAME>/v2.0',
88
clientId: '<APPLICATION_ID>',
99
redirectUrl: 'com.myapp://redirect/url/', // the redirectUrl must end with a slash
10-
scopes: ['openid', 'offline_access']
10+
scopes: ['openid', 'offline_access'],
1111
};
1212

1313
// Log in to get an authentication token

docs/config-examples/azure-active-directory.md renamed to docs/docs/config-examples/azure-active-directory.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,17 @@ See the [Azure docs on requesting an access token](https://docs.microsoft.com/en
1212

1313
Please Note:
1414

15-
* `Scopes` is ignored.
16-
* `additionalParameters.resource` may be required based on the tenant settings.
15+
- `Scopes` is ignored.
16+
- `additionalParameters.resource` may be required based on the tenant settings.
1717

1818
```js
1919
const config = {
2020
issuer: 'https://login.microsoftonline.com/your-tenant-id',
2121
clientId: 'your-client-id',
2222
redirectUrl: 'com.myapp://oauth/redirect/',
2323
additionalParameters: {
24-
resource: 'your-resource'
25-
}
24+
resource: 'your-resource',
25+
},
2626
};
2727

2828
// Log in to get an authentication token
@@ -43,7 +43,7 @@ const config = {
4343
issuer: 'https://login.microsoftonline.com/your-tenant-id/v2.0',
4444
clientId: 'your-client-id',
4545
redirectUrl: 'com.myapp://oauth/redirect/',
46-
scopes: ['openid', 'profile', 'email', 'offline_access']
46+
scopes: ['openid', 'profile', 'email', 'offline_access'],
4747
};
4848

4949
// Log in to get an authentication token

docs/config-examples/coinbase.md renamed to docs/docs/config-examples/coinbase.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,6 @@ const refreshedState = await refresh(config, {
2727

2828
// Revoke token
2929
await revoke(config, {
30-
tokenToRevoke: refreshedState.refreshToken
30+
tokenToRevoke: refreshedState.refreshToken,
3131
});
3232
```

docs/config-examples/dropbox.md renamed to docs/docs/config-examples/dropbox.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ Dropbox provides an OAuth 2.0 endpoint for logging in with a Dropbox user's cred
44

55
Please note:
66

7-
* Dropbox does not provide a OIDC discovery endpoint, so `serviceConfiguration` is used instead.
8-
* Dropbox OAuth requires a [client secret](#note-about-client-secrets).
9-
* Dropbox access tokens are short lived and will expire after a short period of time. To update your access token a separate call needs to be made to [/oauth2/token](https://www.dropbox.com/developers/documentation/http/documentation#oauth2-token) to obtain a new access token.
7+
- Dropbox does not provide a OIDC discovery endpoint, so `serviceConfiguration` is used instead.
8+
- Dropbox OAuth requires a [client secret](/docs/client-secrets).
9+
- Dropbox access tokens are short lived and will expire after a short period of time. To update your access token a separate call needs to be made to [/oauth2/token](https://www.dropbox.com/developers/documentation/http/documentation#oauth2-token) to obtain a new access token.
1010

1111
```js
1212
const config = {

docs/config-examples/fitbit.md renamed to docs/docs/config-examples/fitbit.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ Fitbit provides an OAuth 2.0 endpoint for logging in with a Fitbit user's creden
44

55
Please note:
66

7-
* Fitbit does not provide a OIDC discovery endpoint, so `serviceConfiguration` is used instead.
8-
* Fitbit OAuth requires a [client secret](#note-about-client-secrets).
7+
- Fitbit does not provide a OIDC discovery endpoint, so `serviceConfiguration` is used instead.
8+
- Fitbit OAuth requires a [client secret](/docs/client-secrets).
99

1010
```js
1111
const config = {
@@ -16,8 +16,8 @@ const config = {
1616
serviceConfiguration: {
1717
authorizationEndpoint: 'https://www.fitbit.com/oauth2/authorize',
1818
tokenEndpoint: 'https://api.fitbit.com/oauth2/token',
19-
revocationEndpoint: 'https://api.fitbit.com/oauth2/revoke'
20-
}
19+
revocationEndpoint: 'https://api.fitbit.com/oauth2/revoke',
20+
},
2121
};
2222

2323
// Log in to get an authentication token
@@ -31,6 +31,6 @@ const refreshedState = await refresh(config, {
3131
// Revoke token
3232
await revoke(config, {
3333
tokenToRevoke: refreshedState.refreshToken,
34-
includeBasicAuth: true
34+
includeBasicAuth: true,
3535
});
3636
```

docs/config-examples/fusionauth.md renamed to docs/docs/config-examples/fusionauth.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
FusionAuth does not specify a revocation endpoint so revoke functionality doesn't work. Other than that, full functionality is available.
44

5-
* [Install FusionAuth](https://fusionauth.io/docs/v1/tech/installation-guide).
6-
* Create an application in the admin screen. Note the client id.
7-
* Set the redirect_uri for the application to be a value like `fusionauth.demo:/oauthredirect` where `fusionauth.demo` is a scheme you've registered in your application.
5+
- [Install FusionAuth](https://fusionauth.io/docs/v1/tech/installation-guide).
6+
- Create an application in the admin screen. Note the client id.
7+
- Set the redirect_uri for the application to be a value like `fusionauth.demo:/oauthredirect` where `fusionauth.demo` is a scheme you've registered in your application.
88

99
Use the following configuration (replacing the `clientId` with your application id and `fusionAuth.demo` with your scheme):
1010

docs/config-examples/github.md renamed to docs/docs/config-examples/github.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,12 @@ const config = {
1010
clientId: '<client-id>',
1111
clientSecret: '<client-secret>',
1212
scopes: ['identity'],
13-
additionalHeaders: { 'Accept': 'application/json' },
13+
additionalHeaders: { Accept: 'application/json' },
1414
serviceConfiguration: {
1515
authorizationEndpoint: 'https://github.com/login/oauth/authorize',
1616
tokenEndpoint: 'https://github.com/login/oauth/access_token',
17-
revocationEndpoint:
18-
'https://github.com/settings/connections/applications/<client-id>'
19-
}
17+
revocationEndpoint: 'https://github.com/settings/connections/applications/<client-id>',
18+
},
2019
};
2120

2221
// Log in to get an authentication token

docs/config-examples/google.md renamed to docs/docs/config-examples/google.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,31 +3,32 @@
33
Full support out of the box.
44

55
```js
6-
const GOOGLE_OAUTH_APP_GUID = 'YOUR_GOOGLE_OAUTH_APP_GUID' // it looks something like 12345678912-k50abcdefghijkabcdefghijkabcdefv
6+
const GOOGLE_OAUTH_APP_GUID = 'YOUR_GOOGLE_OAUTH_APP_GUID'; // it looks something like 12345678912-k50abcdefghijkabcdefghijkabcdefv
77
const config = {
88
issuer: 'https://accounts.google.com',
99
clientId: `${GOOGLE_OAUTH_APP_GUID}.apps.googleusercontent.com`,
1010
redirectUrl: `com.googleusercontent.apps.${GOOGLE_OAUTH_APP_GUID}:/oauth2redirect/google`,
11-
scopes: ['openid', 'profile']
11+
scopes: ['openid', 'profile'],
1212
};
1313

1414
// Log in to get an authentication token
1515
const authState = await authorize(config);
1616

1717
// Refresh token
1818
const refreshedState = await refresh(config, {
19-
refreshToken: authState.refreshToken
19+
refreshToken: authState.refreshToken,
2020
});
2121

2222
// Revoke token
2323
await revoke(config, {
24-
tokenToRevoke: refreshedState.refreshToken
24+
tokenToRevoke: refreshedState.refreshToken,
2525
});
2626
```
2727

28-
2928
### Note for Android
29+
3030
To [capture the authorization redirect](https://github.com/openid/AppAuth-android#capturing-the-authorization-redirect), add the following property to the defaultConfig in `android/app/build.gradle`:
31+
3132
```
3233
android {
3334
defaultConfig {
@@ -38,5 +39,6 @@ android {
3839
}
3940
}
4041
```
42+
4143
- You need to check custom URI scheme under APIs & Services -> Credentials -> OAuth 2.0 Client IDs -> Your Client Name -> Advanced Settings
4244
- It may take 5 minutes to a few hours for settings to take effect.

docs/config-examples/identity-server-3.md renamed to docs/docs/config-examples/identity-server-3.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const config = {
1010
clientId: 'your-client-id',
1111
clientSecret: 'your-client-secret',
1212
redirectUrl: 'com.your.app.name:/oauthredirect',
13-
scopes: ['openid', 'profile', 'offline_access']
13+
scopes: ['openid', 'profile', 'offline_access'],
1414
};
1515

1616
// Log in to get an authentication token
@@ -24,7 +24,7 @@ const refreshedState = await refresh(config, {
2424
// Revoke token, note that Identity Server expects a client id on revoke
2525
await revoke(config, {
2626
tokenToRevoke: refreshedState.refreshToken,
27-
sendClientId: true
27+
sendClientId: true,
2828
});
2929
```
3030

docs/config-examples/identity-server-4.md renamed to docs/docs/config-examples/identity-server-4.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const config = {
1212
issuer: 'https://demo.identityserver.io',
1313
clientId: 'native.code',
1414
redirectUrl: 'io.identityserver.demo:/oauthredirect',
15-
scopes: ['openid', 'profile', 'offline_access']
15+
scopes: ['openid', 'profile', 'offline_access'],
1616
};
1717

1818
// Log in to get an authentication token
@@ -26,7 +26,7 @@ const refreshedState = await refresh(config, {
2626
// Revoke token, note that Identity Server expects a client id on revoke
2727
await revoke(config, {
2828
tokenToRevoke: refreshedState.refreshToken,
29-
sendClientId: true
29+
sendClientId: true,
3030
});
3131
```
3232

docs/config-examples/keycloak.md renamed to docs/docs/config-examples/keycloak.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const config = {
99
issuer: 'http://localhost:9080/auth/realms/jhipster',
1010
clientId: 'web_app',
1111
redirectUrl: '<YOUR_REDIRECT_SCHEME>:/callback',
12-
scopes: ['openid', 'profile']
12+
scopes: ['openid', 'profile'],
1313
};
1414

1515
// Log in to get an authentication token

docs/config-examples/microsoft.md renamed to docs/docs/config-examples/microsoft.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
## Microsoft
1+
# Microsoft
22

33
1. Supplying "issuer" fails, because Microsoft returns `issuer` with the literal string `https://login.microsoftonline.com/{tenantid}/v2.0` when `https://login.microsoftonline.com/common/v2.0/.well-known/openid-configuration` is queried.. We need to manually specify `serviceConfiguration`.
44

55
2. `REDIRECT_URL` varies based on platform:
6+
67
- iOS: msauth.com.example.app://auth/
7-
- Android: com.example.app://msauth/<SIGNATURE_HASH>/
8+
- Android: com.example.app://msauth/`<SIGNATURE_HASH>`/
89

910
3. Microsoft does not have. revocationEndpoint.
1011

0 commit comments

Comments
 (0)