Wednesday, 6 April 2016

Re: Offline Refresh Token Can't Generate

Hi Pravin,

The OAuth 2.0 spec provides the following description for that error:

         invalid_grant
               The provided authorization grant (e.g., authorization
               code, resource owner credentials) or refresh token is
               invalid, expired, revoked, does not match the redirection
               URI used in the authorization request, or was issued to
               another client.

I would recommend verifying that the redirect URI specified on your project at https://console.developers.google.com matches what you're using in your requests, and also verify that the refresh token has not been revoked. You might also want to check out the README on our github repo for more details and code examples.

Thanks,
Josh, AdWords API Team


On Wednesday, April 6, 2016 at 5:53:09 AM UTC-4, Zweitze wrote:
You want to generate a refreshtoken once, store that in the database, then use that refreshtoken with software you wrote?

Consider using OAuth2 for applications.
The .NET client library has (or used to have) a sample application called OAuthTokenGenerator. I created some refreshtokens with that application, store that in a database and have software using those tokens every day.

OAuthTokenGenerator may not be present in the current .NET library (no idea actually), I use a copy from a library three years old. Since the authentication is not bound to AdWords API versions, it is still working.

I hope this helps.


On Wednesday, April 6, 2016 at 9:34:26 AM UTC+2, Pravin Yadav wrote:
Hi,

I am using Google AdWords Version v201603 in that taking adwords account data Offline using Dot Net Web Service that time i trying to generate tokens offline using(delegate) and store that in Database and then accessing this tokens for data retrieve that time access token generating each time correctly but refresh token not generating.
 
follow is code i am using: 

         oAuth.OnOAuthTokensObtained += delegate(AdsOAuthProvider pp)
               
           {

                        OAuth2ProviderForApplications oAuth =(provider as OAuth2ProviderForApplications);

                       string refresht = oAuth.RefreshToken;
                       string accesst = oAuth.AccessToken;
                       Date updateo= oAuth.UpdatedOn;
                       int expire = oAuth.ExpiresIn;

            }


Its throwing following error:

             Failed to refresh access token.
              {
                  "error" : "invalid_grant"
              }

Please suggest me any another way or any correction/mistaken in existing code to generate offline Refresh Token. 


Thanks & Regards,

  Pravin Yadav

--
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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/4b484dde-b7e1-4b74-ac65-6013e38b581f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment