Announcements

Help Wizard

Step 1

NEXT STEP

FAQs

Please see below the most popular frequently asked questions.

Loading article...

Loading faqs...

VIEW ALL

Ongoing Issues

Please see below the current ongoing issues which are under investigation.

Loading issue...

Loading ongoing issues...

VIEW ALL

Just fetching the data

Solved!

Just fetching the data

So I'm Creating a reactjs app of Spotify but I have created my own user database,
I just want to use api to fetch the artist can I do that or will I need to do the authentication too with Spotify

 

Reply

Accepted Solutions
Marked as solution

I don't know  why About Ximzend  need to be that dismissive. 
Client Credentials IS an authentication. At app level instead that at user level.
As logic suggest Spotify don't want just random anonymous scripts pull their neatly organized JSON from their database...

You must use the Client ID / Client Secret  to  in the  header of a POST
that ask for ("grant_type", "client_credentials") that will return the access token 

{"access_token":"BQDSaQHwdDMAMmztpDmJ_CgRJjrZPilne86BrkNVSYar-HcV1XXg9Zezo4Tu0tnfbLCc_vUGxH1bg1bRklrgg_ZCJ423aePeD3MYTrnt8DAmMD_-3oc","token_type":"Bearer","expires_in":3600}


that than you can use to get anything not USER related (artists/albumbs/tracks...)

curl --request GET \
  --url https://api.spotify.com/v1/artists/0TnOYISbd1XYRBk9myaseg \
  --header 'Authorization: Bearer THE_TOKEN'



It's really not complicated  and you should really take a look because it is just used everywhere.
Maybe play with postman.com that will simplify a bit the implementation and help understand what it is going on. 

Moderators here removed one of my posts here (because I linked a discord I think) but you people can always send me a PM here in case. 

View solution in original post

14 Replies

Of course, unless you want scrape their website?
Propaganda | Spotify

https://open.spotify.com/artist/28yIUgPYZqgJoNZjeBvrHn

You can use Client Credentials, because you don't access user information.

XimzendSpotify Star
Help others find this answer and click "Accept as Solution".
If you appreciate my answer, maybe give me a Like.
Note: I'm not a Spotify employee.

No I don't want to scrape it... I just want to use api for fetching the data without registering or extracting user information and also don't know the oath stuff too... So I'm confused

Like I said, Client Credentials don't require you to authenticate.

XimzendSpotify Star
Help others find this answer and click "Accept as Solution".
If you appreciate my answer, maybe give me a Like.
Note: I'm not a Spotify employee.

can you just give an example how can I extract that because when I'm searching they are still asking authorization bearer and other stuffs

I tried to access my token using that but it returns :

{
"error": "invalid_client"
}

 

I think you should follow the Getting started with Web API tutorial first.

XimzendSpotify Star
Help others find this answer and click "Accept as Solution".
If you appreciate my answer, maybe give me a Like.
Note: I'm not a Spotify employee.
Marked as solution

I don't know  why About Ximzend  need to be that dismissive. 
Client Credentials IS an authentication. At app level instead that at user level.
As logic suggest Spotify don't want just random anonymous scripts pull their neatly organized JSON from their database...

You must use the Client ID / Client Secret  to  in the  header of a POST
that ask for ("grant_type", "client_credentials") that will return the access token 

{"access_token":"BQDSaQHwdDMAMmztpDmJ_CgRJjrZPilne86BrkNVSYar-HcV1XXg9Zezo4Tu0tnfbLCc_vUGxH1bg1bRklrgg_ZCJ423aePeD3MYTrnt8DAmMD_-3oc","token_type":"Bearer","expires_in":3600}


that than you can use to get anything not USER related (artists/albumbs/tracks...)

curl --request GET \
  --url https://api.spotify.com/v1/artists/0TnOYISbd1XYRBk9myaseg \
  --header 'Authorization: Bearer THE_TOKEN'



It's really not complicated  and you should really take a look because it is just used everywhere.
Maybe play with postman.com that will simplify a bit the implementation and help understand what it is going on. 

Moderators here removed one of my posts here (because I linked a discord I think) but you people can always send me a PM here in case. 

Ya i got that it worked thank You

Also I'm using using spotify API without authentication so can I use there Spotify player or not?

If you want let your app control a player of a user, the user needs to log in.

XimzendSpotify Star
Help others find this answer and click "Accept as Solution".
If you appreciate my answer, maybe give me a Like.
Note: I'm not a Spotify employee.

but I don't want app user credentials just I want to play on the track they click that's all

You can use hyperlinks that play tracks directly using a link with ?go=1 behind them, as I've said under the following Stack Overflow question.

(I couldn't put the Spotify links on here, because they get converted into embeds.)

XimzendSpotify Star
Help others find this answer and click "Accept as Solution".
If you appreciate my answer, maybe give me a Like.
Note: I'm not a Spotify employee.

Thank YOu

 

Suggested posts