No coding skills needed! Just click, paste, and you're done in 2 minutes!
Why This Rocks • Get Started Now • Host Your Own • Use Your Tokens
- Wait... What Even Is This?
- Why You'll Love This
- Get Started (Host Your Own)
- How to Use It (The 3-Step Dance)
- Now What? Use Your Tokens!
- Project Details (For Developers)
- Troubleshooting
- Need Help? Join Our Community!
- Contributing
- License
Great question! Here's the deal:
You know how you want to show off what music you're listening to on your website or Discord? Or maybe build a cool Spotify widget? Well, you need something called a "refresh token" to make that happen.
Getting that token usually involves typing scary terminal commands and reading boring documentation. 😴
This tool? It gives you a pretty website where you just click a few buttons, paste some stuff, and BAM! You get your token. No headaches, no confusion!
Use your tokens to build cool stuff like:
- 🎨 Show your current song on your personal website
- 🤖 Spotify Discord bots that respond to what you're playing
- 📊 Data dashboards with your listening stats
- 🏠 Smart home integrations (Alexa, read my Spotify playlists!)
- 🎮 Gaming overlays showing your music during streams
- 📱 Mobile apps that need Spotify data
Basically, if it involves Spotify + coding, you'll need tokens!
Here's what makes this tool awesome:
| 🎨 Super Easy | Just click buttons - no terminal commands or code to copy-paste! |
|---|---|
| 🔒 100% Safe | We don't store ANYTHING. Your secrets stay secret! |
| ⚡ Lightning Fast | Get your token in literally 2 minutes |
| 📱 Works Everywhere | Phone? Tablet? Computer? All good! |
| 🎉 Looks Beautiful | Spotify green theme that doesn't hurt your eyes |
| 🆓 Free Forever | Host it yourself for free on any platform |
| 🌍 Host Anywhere | Render, Railway, Heroku, Vercel - take your pick! |
| 🤖 Auto-Magic Setup | No config files to mess with - it just works! |
Pick your favorite platform and click the button.
Why Render? Free tier, automatic HTTPS, reliable uptime.
- Click ➡️
- Connect your GitHub (they'll guide you).
- Give it a name (e.g.,
my-spotify-tokens). - Fill in the details:
- Build Command:
pip install -r requirements.txt - Start Command:
gunicorn app:app
- Build Command:
- Click "Create Web Service".
- Wait 2-3 minutes ☕
- Important: Go to your Spotify Dashboard and add your new Render URL +
/callbackto the Redirect URIs.- Example:
https://my-spotify-tokens.onrender.com/callback
- Example:
Why Railway? Simple setup, automatic deployments.
- Click ➡️
- Sign in with GitHub.
- Click "Deploy Now".
- Wait 2 minutes ⏰
- Important: Go to your Spotify Dashboard and add your new Railway URL +
/callbackto the Redirect URIs.- Example:
https://my-app.railway.app/callback
- Example:
Why Heroku? Industry standard, robust platform.
- Install the Heroku CLI.
- Open your terminal and run:
git clone [https://github.com/SahooShuvranshu/Spotify-Refresh-Token-Generator.git](https://github.com/SahooShuvranshu/Spotify-Refresh-Token-Generator.git) cd Spotify-Refresh-Token-Generator heroku create my-cool-token-generator git push heroku main - Important: Go to your Spotify Dashboard and add your new Heroku URL +
/callbackto the Redirect URIs.- Example:
https://my-cool-token-generator.herokuapp.com/callback
- Example:
Why Vercel? Blazing fast, great for serverless.
- Install Vercel CLI:
npm i -g vercel - Run:
vercel --prod - Follow the prompts.
- Important: Go to your Spotify Dashboard and add your new Vercel URL +
/callbackto the Redirect URIs.- Example:
https://your-app.vercel.app/callback
- Example:
Want to run it on your own computer?
-
Get the code
git clone [https://github.com/SahooShuvranshu/Spotify-Refresh-Token-Generator.git](https://github.com/SahooShuvranshu/Spotify-Refresh-Token-Generator.git) cd Spotify-Refresh-Token-Generator -
Set up Python stuff (one-time thing)
python -m venv venv # Windows users: venv\Scripts\activate # Mac/Linux users: source venv/bin/activate
-
Install dependencies
pip install -r requirements.txt
-
Run it!
python app.py
-
Open your browser and go to:
http://localhost:5000 -
Important: Go to your Spotify Dashboard and add
http://localhost:5000/callbackto your Redirect URIs.
Okay, your token generator is live! Now what? Let's get those tokens!
- Visit your deployed URL (the one you just created!)
- Click the big green button that says "📝 Create Spotify App".
- You're now on Spotify Dashboard! Fill this out:
Example:
App Name: My Awesome Token Generator App Description: Getting tokens like a boss! Redirect URI: [paste your URL from the generator]/callbackhttps://my-tokens.onrender.com/callback - Click "Save".
- Copy these two things:
- Client ID
- Client Secret (click "Show Client Secret", then copy)
- Go back to your token generator website.
- Paste your Client ID and Client Secret into the boxes.
- Click "🚀 Authorize with Spotify".
- Spotify asks permission - Click "Agree"!
- You'll be redirected back to your app.
- Enter your Client Secret again (security!).
- Click "🎯 Get Refresh Token".
- BOOM! 💥 You now see your REFRESH_TOKEN.
- Copy all three (Client ID, Client Secret, Refresh Token) and save them somewhere safe!
Got your tokens? Awesome! Here's how to USE them in your projects!
For the Spotify Live Banner Project
- Create a
.envfile in your project folder. - Open
.envand paste your tokens:SPOTIFY_CLIENT_ID=paste_your_client_id_here SPOTIFY_CLIENT_SECRET=paste_your_client_secret_here SPOTIFY_REFRESH_TOKEN=paste_your_refresh_token_here
- Save and run your app! It'll automatically use these tokens!
Add these as Environment Variables in your hosting platform (Render, Railway, Heroku, etc.):
SPOTIFY_CLIENT_ID=paste_your_client_id_hereSPOTIFY_CLIENT_SECRET=paste_your_client_secret_hereSPOTIFY_REFRESH_TOKEN=paste_your_refresh_token_here
Your app will read these variables and start working!
You can use Environment Variables to configure the app.
| Variable | Description | Required | Default |
|---|---|---|---|
REDIRECT_URI |
OAuth callback URL | No | Auto-detected |
PORT |
Server port | No | 5000 |
FLASK_ENV |
Flask environment | No | production |
Token-Generator/
│
├── app.py # Main Flask application
├── requirements.txt # Python dependencies
├── Procfile # Heroku process file
├── runtime.txt # Python version specification
├── render.yaml # Render deployment config
├── vercel.json # Vercel deployment config
├── test_app.py # Unit tests
├── README.md # This file
│
└── templates/ # HTML templates
├── index.html # Home page with OAuth flow
└── callback.html # Token display page
| Method | Endpoint | Description |
|---|---|---|
GET / |
Home page | Serves the main HTML page. |
POST /start |
Initiate Auth | Takes client_id and returns a Spotify auth_url. |
GET /callback |
Spotify Callback | Handles the redirect from Spotify, contains code. |
POST /exchange |
Get Token | Exchanges code, client_id, client_secret for tokens. |
GET /health |
Health Check | Returns OK (200 status). |
This application is designed with security as a top priority:
| Feature | Implementation |
|---|---|
| No Database | Zero persistent storage of credentials. |
| Session-Only Storage | Credentials are cleared after the token is generated. |
| HTTPS Enforced | All production deployments use SSL/TLS. |
| No Server-Side Storage | Server only facilitates the OAuth flow. |
Best Practices for Users:
- Never share your Client Secret - Treat it like a password.
- Use HTTPS URLs - Always deploy with SSL.
- Revoke unused apps - Delete old apps from your Spotify Dashboard.
Don't panic! Here are fixes for common issues:
- Problem: Spotify doesn't recognize your callback URL.
- Solution: Go to your Spotify Dashboard. Click your app -> Edit Settings. Make SURE the redirect URI is EXACTLY
https://your-exact-url.com/callback. No typos! No extra/at the end!
- Problem: Wrong Client ID or Client Secret.
- Solution: Go back to your Spotify Dashboard and carefully copy the Client ID and Client Secret again. Ensure there are no extra spaces.
- Problem: You took too long (more than 10 minutes) to exchange the code.
- Solution: Just start the process over from Step 1. Be faster this time! ⚡
- Problem: Something went wrong during deployment.
- Solution: Check your platform's logs (Render, Railway, etc.). The error message is usually there. Make sure your
Start Commandisgunicorn app:app.
Get help from the community!
- 💡 Ask questions and get instant answers
- 🤝 Share your projects built with this tool
- 🐛 Report bugs and get support
- 🎉 Connect with other developers
- 📢 Get updates on new features
Click here to join our Discord server!
Contributions are welcome!
- Check existing Issues.
- If it's a new bug, create a new issue with steps to reproduce.
- Fork the repository.
- Create a feature branch:
git checkout -b feature/amazing-feature - Make your changes and test them locally.
- Commit your changes:
git commit -m 'Add amazing feature' - Push to the branch:
git push origin feature/amazing-feature - Open a Pull Request!
This project is licensed under the MIT License. Basically, do whatever you want with this code!
If this tool helped you, consider:
- ⭐ Starring this repo!
- 🍴 Forking it to make your own version.
- 💌 Sharing it with other developers.