Skip to content

Commit

Permalink
Update Vue2 example for Auth0-SPA-JS v2 (#204)
Browse files Browse the repository at this point in the history
  • Loading branch information
frederikprijck authored Feb 1, 2023
1 parent 3fbead6 commit b43d86c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
12 changes: 7 additions & 5 deletions tutorial/vue2-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,24 +24,26 @@ Following on from the [previous tutorial](vue2-login.md), add your API Identifie
{
"domain": "<YOUR AUTH0 DOMAIN>",
"clientId": "<YOUR AUTH0 CLIENT ID>",
"audience": "<YOUR AUTH0 API IDENTIFIER>"
"authorizationParams": {
"audience": "<YOUR AUTH0 API IDENTIFIER>"
}
}
```

Finally, open `main.js` and configure the Auth0 plugin with this audience value:
Finally, open `main.js` and configure the Auth0 plugin with this authorizationParams value, which includes the audience:

```js
// .. other imports

// NEW - import the audience
import { domain, clientId, audience } from '../auth_config.json';
// NEW - import the authorizationParams, which includes the audience
import { domain, clientId, authorizationParams } from '../auth_config.json';

// ..

Vue.use(Auth0Plugin, {
domain,
clientId,
audience, // NEW - configure the plugin with the audience value
authorizationParams, // NEW - configure the plugin with the authorizationParams value
onRedirectCallback: appState => {
router.push(
appState && appState.targetUrl
Expand Down
7 changes: 5 additions & 2 deletions tutorial/vue2-login.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,8 @@ export const useAuth0 = ({
this.auth0Client = await createAuth0Client({
...options,
authorizationParams: {
redirect_uri: redirectUri
redirect_uri: redirectUri,
...options.authorizationParams
}
});

Expand Down Expand Up @@ -286,7 +287,9 @@ export default {
// Log the user out
logout() {
this.$auth.logout({
returnTo: window.location.origin
logoutParams: {
returnTo: window.location.origin
}
});
}
}
Expand Down

0 comments on commit b43d86c

Please sign in to comment.