Google Photo API

Hello,

I am facing a little issue when trying to make my oAuth process.
I have setup an API action with oAuth2 Authorize and i trigger it when clicking on a button in my page. the process works fine but then I am redirected to my api action with the tokens. What next? How do i use the tokens? where are they stored? I am confused.

I saw the series of tutorials but this part is not treated...

Thanks!

Ok so if I understood I need to store the tokens myself (session or Db) and then use them to access the api or check if they are still valid?

Don't exactly understand, you need to get the info from google photos?
All on the server side?

Check this for the scopes needed on the oauth part:
https://developers.google.com/photos/library/guides/authorization

The tokens are retrieved when you get the code, here's the flow:
https://developers.google.com/identity/protocols/oauth2/web-server

Saying that as far as I know you'll need to use the api on the server side:
https://developers.google.com/photos/library/reference/rest/v1/albums/list
And use the refresh token each time to get the access token.
And when you get the access token, you call:
url: https://photoslibrary.googleapis.com/v1/albums
header: Authorization: Bearer ACCESS_TOKEN

Don't store the access token

Use the refresh token and store it on a secure place:

Note: Save refresh tokens in secure long-term storage and continue to use them as long as they remain valid.