Tamizharasan
Tamizharasan

Reputation: 293

can't get refresh access token from google in live server

I am creating a google application to get the user google account data. when i am using the oauth 2 in local with access_type = 'offline', it asks for offline access permission and i can get the refresh access token. But if i use the same code for my live server it didn't ask for offline permission and i can't get the refresh token as well. I am using oriceon oauth 5 package for my laravel application.I did like following

    $googleService = OAuth::consumer('Google');
    $googleService->setAccessType('offline');` 

your Suggestion will helpful for me. Thank You

Upvotes: 0

Views: 919

Answers (1)

Tamizharasan
Tamizharasan

Reputation: 293

I found the answer, actually that application stores my access_token in my computer cookies, and it send my key every time using session, so i can't get the refresh token. so what u need to do is, u need to add an option called approval_prompt as force in ur redirect uri like (redirect_uri/approval_prompt=force). It will ask offline access token every time when the application called. check the following link for your reference

support approval_prompt: force to get new `refresh_token

Why does Google OAuth2 re-ask user for permission when i send them to auth url again

Upvotes: 1

Related Questions