https://github.com/noook/nuxt-spotify-playground
https://github.com/noook/nuxt-spotify-playground
Last synced: about 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/noook/nuxt-spotify-playground
- Owner: noook
- Created: 2024-04-30T23:31:04.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-05-01T10:31:32.000Z (about 2 years ago)
- Last Synced: 2025-02-09T04:28:00.155Z (over 1 year ago)
- Language: TypeScript
- Size: 83 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Nuxt Spotify — Now playing example
## Setup
Make sure to install the dependencies:
```bash
# pnpm
pnpm install
```
## Configuration
Create a `.env` file in the root of the project with the following content:
```bash
NUXT_SPOTIFY_CLIENT_ID=YOUR_SPOTIFY_CLIENT_ID
NUXT_SPOTIFY_CLIENT_SECRET=YOUR_SPOTIFY_CLIENT_SECRET
# Will be filled in the next step
# NUXT_SPOTIFY_REFRESH_TOKEN=
```
## Development Server
Start the development server on `http://localhost:3000`:
```bash
# pnpm
pnpm run dev
```
## Generate Refresh Token
Head to `http://localhost:3000`, open the Nuxt Devtools under the "Server tasks tab", then run the `spotify:auth` command. This will
output an authorization URL where you need to authorize the app. After that, you will be redirected on the app with an access token object.
Copy the `refresh_token` value and paste it in the `.env` file.
```bash
NUXT_SPOTIFY_REFRESH_TOKEN=
```
## Using the refresh token
Now that you generated your initial token refresh, you can pass it as a runtime environment variable,
so you don't have to generate it every time you start the server. This is also how you'll use it in production.
You can test your refresh token by running the server task `spotify:now` in the devtools.