oauth2_example
oauth2_example copied to clipboard
Making a request outside of the callback
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
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!