0

I am making an app that returns a music playlist based on a user’s age. The user does not need need to log in to their account; they only need to provide their age. I also have no need for a database, so I decided that I want to make the application front-end only.

In order to make requests to Spotify’s API, I need an access token which I get via client credentials, because the user doesn't need to login using that flow. However, the script I used to get the access token must be run from the server-side, which I discovered here: Access-Control-Allow-Origin denied spotify api.

The alternative solution is to use the implicit grant flow, which will allow the script to be run client-side but will require a user to log in. So, both the client-credentials and implicit grant flow don't solve my problem.

How can my web app get an access token so that I don't need to implement a server-side or have the user log in?

Although the idea is different, I want to do something like this person is doing @ http://sixdegreesofkanyewest.com/. No one logs in, yet he is able to get an access token and send api requests on their behalf. And I don't really see why that website would require a database either.

If I do end up having to develop a back-end, then I would be able to use client-credential flow. But, how would my back-end send the access token to my front-end without a DB?

Any help is appreciated. Thank you!

redxmarker
  • 41
  • 1
  • 4

1 Answers1

1

Implicit grant is recommended for javascript based application, who can not keep secrets safe. So you may have to strike out this option.

Having a server page, (hope the credentials kept safe in your server), then server app sending the request for token and rendering the page..

I guess that is what the http://sixdegreesofkanyewest.com/ will be doing.

So your option is server pages application. or an intermediate API call to get the access token for you and continue your application logics

Jay
  • 1,869
  • 3
  • 25
  • 44