Tuesday, 22 December 2015

Refreshing a Token with php api

I've been poking through the API and have found various functions in different places that look like they are involved in refreshing tokens.  Nothing I am doing is working.

My code as follows

            // oauth 2 config
            $credentials= array(
              'client_id' => $config['id'],
              'client_secret' => $config['secret'],
              'access_token' => $params['access_token'],
              'refresh_token' => $params['refresh_token']
            );

            $user = new \AdWordsUser(null, $adwords['dev_token'], $adwords['useragent'], null, null, $credentials);

            $handler = $user->GetOAuth2Handler();
            $oauth2Info = $handler->RefreshAccessToken($user->GetOAuth2Info());
            $user->SetOAuth2Info($oauth2Info);

Using this code here I would expect that the access token would get refreshed.  If I try to make any call after it however I get 

{\n \"error\" : \"unauthorized_client\"\n}

Thoughts?

--
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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+unsubscribe@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+unsubscribe@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/1ba789df-bfd3-4a6f-b3ec-e87247ed9a95%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment