oauth2_example icon indicating copy to clipboard operation
oauth2_example copied to clipboard

Making a request outside of the callback

Open JayChetty opened this issue 9 years ago • 1 comments

Hi,

Thanks for the library and this example.

I was wondering how to make a request to the Oauth provider outside the callback action.
In the example we use the whole received token to make the request, but only store token.access_token on the session. How can we make a request using the stored access_token?

Thanks again, Jay

JayChetty avatar Jul 17 '16 07:07 JayChetty

Hi @JayChetty,

Basically what you'd probably do in a real application is store the token in the database associated with the user record. You could update the token whenever the user logs into your application and fetch data anytime.

I'm working on improvements to the OAuth2 library and will probably expand this example app to use Ecto for a more realistic scenario.

Hope that helps!

scrogson avatar Jul 26 '16 05:07 scrogson