https://github.com/sambego/auth0-device-flow
A simple JavaScript implementation to use the OAuth Device Authorization Grant with Auth0
https://github.com/sambego/auth0-device-flow
Last synced: about 1 year ago
JSON representation
A simple JavaScript implementation to use the OAuth Device Authorization Grant with Auth0
- Host: GitHub
- URL: https://github.com/sambego/auth0-device-flow
- Owner: Sambego
- Created: 2023-06-06T09:22:34.000Z (about 3 years ago)
- Default Branch: 0-start
- Last Pushed: 2023-06-06T13:27:56.000Z (about 3 years ago)
- Last Synced: 2025-04-12T07:59:25.912Z (about 1 year ago)
- Language: CSS
- Homepage:
- Size: 31.3 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Get Started
## Setup your Auth0 tenant and application
- Create a free account on [auth0.com](https://auth0.com) if you don't have one already
- Create a new "native application" called "Device Flow" in your Auth0 dashboard
- Add `http://localhost:5173` as an allowed callback URL, allowed logout URL and allowed web origin. (If you're not using Vite or have changed the port, make sure to use your developement URL)
- Enable the "Allow Cross-Origin Authentication" toggle
- Under Advanced settings > Grant Types, make sure "Device Code" is enabled
## Run the application
- run `npm install` to install all dependencies
- copy the `.env.sample` file to `.env`
- Add your Auth0 application's client ID and Domain to the `.env` file
- run `npm run dev` to start a development server
# Branches
When following along with the video, there are multiple branches for each section of the video.
- `0-start`: The basic scaffolding is ready to be used
- `1-device-code`: We'll request a device and user code
- `2-poll`: We start polling for tokens, which should be available once the user authenticates on their device
- `3-user`: We'll display the user information once we have the tokens available
- `4-connect`: We'll add a lightweight server to talk to a Raspberry Pi and open a connected lock when the user authenticates