lynndylanhurley / devise_token_auth

Token based authentication for Rails JSON APIs. Designed to work with jToker and ng-token-auth.
Do What The F*ck You Want To Public License
3.52k stars 1.14k forks source link

Getting access_token to use for API requests to Google #626

Open colinexl opened 8 years ago

colinexl commented 8 years ago

Hello All,

I'm not sure if devise_token_auth is the right tool for this job. I'm currently using devise_token_auth with omniauth_oauth2 and omniauth-google-oauth2 to authenticate users and this is working fine.

What I want to do is to somehow use the existing tokens saved in the DB, which have been authorized by the users already, to make requests against Google oauth APIs such as getting user's Contacts or listing their Drive files.

I've read a bunch of tutorials on how to do this with just omniauth_oauth2, omniauth-google-oauth2 and the google-api-client, but none of them explain how to integrate this with devise_token_auth.

I looked through the code and didn't see that devise_token_auth actually saves the refresh_token either, which is needed to get updated access_token.

Is this possible with devise_token_auth or do I need to build a custom solution?

Thanks, Colin

tagazok commented 7 years ago

Hi, I am having the same issue. I am using Instagram omniauth adaptor but then I would like to use the Instagram gem to call the API but I don't have access to the Instagram access_token of the logged in user.