Skip to content

Commit

Permalink
feat: Export properties to be used outside the view instance
Browse files Browse the repository at this point in the history
  • Loading branch information
upwebdesign authored Aug 25, 2021
1 parent ffcbeb7 commit 91a5829
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,14 @@ if (!AuthenticationState.authenticated) {
}
```

If you want to use the properties provided by Auth0 when you do not have access to the Vue instance, you can use the exported AuthenticationProperties.

```js
import { AuthenticationProperties as auth0 } from 'vue-auth0-plugin';

const token = auth0.getTokenSilently();
```

## AuthenticationGuard

The plugin implements a Vue Router NavigationGuard to secure routes with Auth0. The example below shows how to use this AuthenticationGuard.
Expand Down
3 changes: 2 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ export default {
};

const AuthenticationState = Plugin.state;
export { AuthenticationGuard, AuthenticationState };
const AuthenticationProperties = Plugin.properties;
export { AuthenticationGuard, AuthenticationState, AuthenticationProperties };

0 comments on commit 91a5829

Please sign in to comment.