How to Authenticate With Spotify Using Auth0 π’
Using Auth0 to Authenticate with Spotify and Show Account Details

Software Engineer. Improviser.
From Romania
Search for a command to run...
Using Auth0 to Authenticate with Spotify and Show Account Details

Software Engineer. Improviser.
From Romania
Thinking about it, that Gravatar picture always comes up for me on random websites if I register through my Google account. I also find it very weird and annoying (mainly because I have no idea where that profile picture comes from π€). Is your Spotify account connected to your Google or Facebook account? That could partly explain it.
Anyway, great job and a great inspiration to create Spotify applications π
Thanks a lot, Elisa. Yeah, I also have my email connected to Gravatar and I was really surprised what picture I had set up, lol. I did it a long time ago. What is still not clear for me is why doesn't the Spotify account picture show up. I tried with a brand new account that doesn't have a connection to Gravatar and the shown picture is one generated from the name. Really weird.
Thank you, James!
What Are Objects and What Type of Objects Are There in Javascript?

Taking a Look at Javascript Primitives Data Types

How to Stay Consistent and Come Up With Article Ideas?

Ideas and Tips from Quincy Larson and Edidiong Asikpo

Lately I've been checking out Auth0. It's a platform that provides authentication and authorization solutions over a wide range of use cases.
A feature that caught my attention was the social log in. You can set up your application to accept credentials and acces your account data from social platforms like Facebook, Twitter, Google and more. The feature extends to any platform that complies with the OAuth specifications.
I thought it would be interesting to try this out with Spotify. I'll show you how I did it.
The final result is a web app which shows a login box and you can connect with your Spotify account. It will then show the name, email and picture from the account.

Before you can integrate Auth0 in the application you need to register your Spotify account as a Developer account.
You can do that at the Spotify Developer Dashboard.
After you log in (if not already) and accept the terms you will be redirected to the dashboard.


The app is created.

You will need the Client ID and the Client Secret from this app to connect with Auth0 app.

Hit "Show Client Secret".
Do not share the Client Secret with anyone (only with the Auth0 app).

First, you'll need to register to Auth0.
Select a Personal type of account.

You will need to create an application in the Auth0 dashboard.
Go to Applications β Applications

Hit "Create Application".
Select a name for your application. For mine I chose Spotify Auth0.
And make it a Single Page Web Application.

After you create it you will see some instructions on how to integrate Auth0 in your application. We will look into that later.
Next you will create the social connection.
Go to Authentication β Social
Hit "Create Connection".
Search for "Spotify".

Click on it.

Hit "Continue".

In Client ID you will add the Client Id from the Spotify App.
in Client Secret you will add the one from the Spotify App.

Hit "Create".
Then enable the connection for the app from Auth0.

You need to add some info from Auth0 to the Spotify app.
Hit "Edit Settings".

You need to add in the Spotify app a redirect URL. The URL can be deduced from the Auth0 application you created earlier.

It is https://<Domain>/login/callback.
In my case it is https://dev-t4oahv4f.us.auth0.com/login/callback.
Don't forget the https:// or http:// before the redirect URI.

Hit "Add" then "Save".
The account you used to create the Spotify App will have permisions to authenticate to it. If you want additional accounts to have access you need to add them in the "Users and Access" pannel.

In the Spotify connection dashboard in Auth0 you can test the connection.

An authorization page will open.

After you agree, a success page should appear.

If something went wrong then double check your settings.
The redirect URL from Spotify needs to exactly match the one from the Auth0 app.
For this project I created a web app, but Auth0 allows integration with desktop, mobile and IoT apps as well.
The code for the app can be found here: https://github.com/alexzaharia24/spotify-auth0
I used React.
Created the app using create-react-app.
I could lay out the steps here, but already detailed instrunctions can be found in the Quick Start section of your Auth0 Application.


We're done!
What do you think about Auth0?
Let me know what you think in the comments or if you know where is the account picture taken from.