Hi Swetha,

Thank you for your help, I think now found the solution.. (But I guess its 
not yet updated on that Web Flow Guide documentation)

To share with the other guys also that may encounter the same problem..

I successfully get the refresh_token after, I included this "
*prompt=consent*" and change *access_type *"online" to "offline" 

*Code*
 // Redirect the user to the authorization URL.
    $config = [
        // Set to 'offline' if you require offline access.
        'access_type' => 'offline',
        'prompt' => 'consent',
    ];
    header('Location: ' . $oauth2->buildFullAuthorizationUri($config));

Its now gave me the refresh_token :) then after getting refresh_token I 
temporarily stored it to Session (will change logic in Production)

then appended it to my opening of OAuth2 object

  $oauth2 = new OAuth2([
                'authorizationUri' => 
'https://accounts.google.com/o/oauth2/v2/auth',
                'tokenCredentialUri' => 
'https://www.googleapis.com/oauth2/v4/token',
                'redirectUri' => 'http://dev.xxxx.com/testing.php',
                'clientId' => '82698.....ontent.com',
                'clientSecret' => 'dJCc.....1T8I',
                'scope' => 'https://www.googleapis.com/auth/adwords',

                'refresh_token' => $_SESSION['refresh_token']
  ]);

Though i'm not sure if this the correct way to do it..  This works 
perfectly to me! 

Again thank you for your help..



On Wednesday, September 20, 2017 at 5:44:53 AM UTC+8, Shwetha Vastrad 
(AdWords API Team) wrote:
>
> Hi Joven,
>
> For Web flow type applications, the refresh token is only returned if the 
> access_type HTTP query parameter is set to "offline" when you direct the 
> user to Google's OAuth 2.0 server. I see that you have set this parameter. 
> Could you check if this parameter is being passed correctly in the 
> authorization URL? Could you check if a value is returned for 
> "$authToken['refresh_token'];" when you authorize for the first time? 
>
> Thanks,
> Shwetha, AdWords API Team.
>

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and Google+:
https://googleadsdeveloper.blogspot.com/
https://plus.google.com/+GoogleAdsDevelopers/posts
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords API Forum" group.
To post to this group, send email to adwords-api@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"AdWords API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to adwords-api+unsubscr...@googlegroups.com.
Visit this group at https://groups.google.com/group/adwords-api.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/9a5d4c7c-1796-4cb9-b91e-ad7c4a6d8152%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to