Spotify connection with additional scopes

Hi I am trying to create a Spotify authentication for my app, but I’d need more scopes than the ones offered at the default Social Connection (user-read-private and user-read-email)

I have tried, thus, to create a custom connector using the “Custom Social Connections”.

I have it configured to use Spotify’s urls accounts[.]spotify[.]com/authorize and accounts[.]spotify[.]com/api/token.

However, when I try to test the connection I get the following error:

{
  "error": "invalid_request",
  "error_description": "Invalid user id."
}

At my spotify application I have the uri opted-in:

dev-xxx[.]us[.]auth0.com/login/callback

At the same time, the standard Spotify Connection does work, however I don’t have the necessary scopes.

Am I missing something ? How can I accomplish this ?

Hi @lhrolim,

Yes, that’s correct. You should use the Custom Social Connections extension to add additional scopes to your Spotify connection.

I have checked your tenant’s custom Spotify social connections and noticed neither connection is configured. It is missing values for all fields, such as the authorization URL, token URL, scope, client ID, etc.

I recommend that you fully configure your custom Spotify social connection so that the login works correctly.

Thanks,
Rueben

Thanks for reaching out Rueben!

That’s strange, I do have it configured at con_XtOlEZ9HaG6CS3CW.

After some chat GPT help, I was able to come up with a custom Fetch User Profile Script which helped me to get past that original issue I shared.

I do see a “it works” when testing the connection now, and on my react app I also get the jwt token.

However, when I try to use the token against spotify APIs, I am getting 401s. I am not sure if there’s anything missing, but I understood the token issued by Auth0 would grant me access to Spotify APIs transitively.

1 Like

Hi @lhrolim,

Thanks for the update.

Usually, a 401 error indicates an unauthorized error, which happens if you are missing certain scopes or permissions. I recommend that you decode your JWT access token and make sure you have the required payload to use the token against Spotify API’s.

Let me know how that goes for you.

Thanks,
Rueben