Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tnguyen14/auth
Client-side JWT auth using local storage and Auth0 OAuth2 flow.
https://github.com/tnguyen14/auth
auth0 jwt localstorage oauth2
Last synced: about 2 months ago
JSON representation
Client-side JWT auth using local storage and Auth0 OAuth2 flow.
- Host: GitHub
- URL: https://github.com/tnguyen14/auth
- Owner: tnguyen14
- Created: 2016-07-18T02:06:59.000Z (over 8 years ago)
- Default Branch: main
- Last Pushed: 2024-01-07T21:36:58.000Z (about 1 year ago)
- Last Synced: 2024-10-13T07:04:51.994Z (3 months ago)
- Topics: auth0, jwt, localstorage, oauth2
- Language: JavaScript
- Homepage:
- Size: 456 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Auth
> Helper functions to work with Auth0
## Usage
### SPA
```js
import createAuth from "@tridnguyen/auth/spa";const auth0 = await createAuth({
clientId
authorizationParams: {
redirect_uri: window.location.href,
audience: 'https://lists.cloud.tridnguyen.com',
scope: 'openid profile email'
}
});await auth0.getTokenSilently({
authorizationParams: {
audience: 'https://lists.cloud.tridnguyen.com',
scope: 'read:list write:list'
}
});await auth0.logout({
logoutParams: {
returnTo: window.location.href
}
})
```### Machine to machine
```js
import { getToken } from "@tridnguyen/auth/server";const token = await getToken({
clientId,
clientSecret,
audience
})
```