Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarify obtaining a refresh token that can be used to obtain JWT acce… #984

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions EXAMPLES.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,28 @@ const { data: tokens } = await auth.oauth.clientCredentialsGrant({
});
```

### Use a Password Grant to get a Refresh Token
```js
import { AuthenticationClient } from 'auth0';

const auth = new AuthenticationClient({
domain: '{YOUR_TENANT_AND REGION}.auth0.com',
clientId: '{YOUR_CLIENT_ID}',
clientSecret: '{YOUR_CLIENT_SECRET}',
});

// Get a refresh token
const {
data: { refresh_token },
} = await auth.oauth.passwordGrant({
username: '{USER_USERNAME}',
password: '{USER_PASSWORD}',
scope: "offline_access", // To get a refresh token, the scope "offline_access" must be included in the request
audience: 'you-api', // For subsequent refresh token grants to return JWT access tokens, instead of opaque access tokens (tokens without payloads), audience must be included in the original grant
});

```

### Use Refresh Tokens

```js
Expand Down