What I'm trying to achieve: user clicks a button on a React page, is redirected to Spotify to authorize, comes back to my page and my app receives an access token.
I figured that I need to use the implicit grant flow from their authorization docs. I'm using jQuery to send a GET request:
$.ajax({
url: urlToFetch,
type: 'GET',
success: data => {
// what do I put here?
}
})
I can't figure out what to put in the success function, to redirect the user to their login page and then redirect them back with an access token?
Sorry if this is a silly question - I'm a beginner but I just can't figure it out.
fetch(urlToFetch).then(response => { }, 'json')
- but I still don't know what to put inside the curly brackets. My problem is I don't understand what function to write to redirect the user to the login page and back.window.location.href = '/whatever';
to navigate to a URL.