When a user first visits our app, we'll prompt them to log in to Spotify, then store the access token and refresh token from the resulting URL query params in local storage. ![]() Here's our gameplan for using local storage in our app: In simpler terms, local storage will let us store data in the browser for a particular domain and persist it, even when the user closes the tab or navigates away from our app. Session storage only stores data for the duration of the page session, while local storage stores data even after the browser is closed. Local storage is very similar to session storage, but there's a key difference between the two. We can store our tokens in local storage, a mechanism of the Web Storage API which lets us store key/value pairs in the browser. We don't want our users to have to go through the login flow every time they visit our app, so how do we fix this problem? Local storage gameplan # ![]() Our React app is only aware of the Spotify access token when it's stored as a query parameter on the URL - meaning if we visit again, we'll see the login button, not the logged-in state. Now, although we're able to let users log in to Spotify and grab the access token from the URL, we still have a problem.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |