Storing returned API information for authentication purposes

Hi there. I’m trying to create an app with AppGyver that would utilize several APIs. In order to access some of the APIs, I need a user to authenticate with that service. I’ll use the example of Spotify. Let’s say I wanted users to authenticate with Spotify and then make API calls from AppGyver to Spotify API to return that user’s name, song information, most recently listened to music, etc.

I can see very clearly within AppGyver and Spotify’s documentation how to make the GET calls to return information but it all relies on me getting the user’s permission first. Is there a way to get this “Authenticate with Spotify” ability from AppGyver? Any help would be much appreciated.

I don’t know the specifications of Spotify, so I can’t say for sure, but I checked Spotify’s documentation and it seems to use RefreshToken to update the token, so I think it is possible to incorporate an API that updates the token with RefreshToken when it expires.
I think it would be possible if the user’s name, song information, and recently listened to music are in response.

Thank you for your quick response! I’m confused as to how I could keep the information though. If the user clicks “Sign in with Spotify” from my AppGyver app, I would make a POST request with the user’s credentials and the response should have the token, correct? If that is the case, where would I store the token within AppGyvver? Is that something that it will handle automatically? (I’m new to this if that was unclear :slight_smile: ). Any help is appreciated!

I think we can store it in client side storage.
Store it in the client side storage and assign it to the app variable from the client side storage when the application starts.

A more simple way would be to use Set Item to Storage / Get Item from Storage.
Those functions you just specify a unique Key to store/read whatever Value.
You can find both of those flow functions in the Marketplace.

An example of that in one of my apps where i store a password:

Thank you both. I think I need to back up to get a thorough understanding of the steps I should be taking.

  1. Create a page where user can “sign up with Spotify” (digging through Spotify’s documentation I know [this flow will](https://SPTConfiguration *configuration = [[SPTConfiguration alloc] initWithClientID:@“your_client_id” redirectURL:[NSURL urlWithString:@“your_redirect_uri”]]:wink: enable user authentication)
  2. I’ll receive a response with the user’s tokens which I should be able to store the way John described above.
  3. Any further GET or POST requests I can use those stored tokens associated with the user?

If those are the steps, it’s not clear to me how I would link the tokens with the user as well.
I appreciate all the help so far everyone, anything helps - my first time trying to do this on the engineering side.

There was a strange typo. Trying to re-hyperlink this flow