Hi!
I don't getting REFRESH_TOKEN for WEB-app with access_type = "offline".
The code below:
flow = client.OAuth2WebServerFlow(
client_id=client_id,
client_secret=client_secret,
scope=oauth2.GetAPIScope('adwords'),
user_agent='Test',
access_type="offline",
redirect_uri="http://my_actual_site.com"
)
auth_code = 'got code here'
auth_uri = flow.step1_get_authorize_url()
credentials = flow.step2_exchange(auth_code)
credentials.to_json()
refresh_token = null
What can I do in this situation?
If I use Installed application - I work correctry.
I use this
doc:
https://github.com/googleads/googleads-python-lib/wiki/API-access-on-behalf-of-your-clients-(web-flow)
And *Step 5 *is not actually working for me.
On Tuesday, 28 February 2017 21:52:17 UTC+3, Shwetha Vastrad (AdWords API
Team) wrote:
>
> Hi,
>
> Could you check if the access_type
> <https://developers.google.com/identity/protocols/OAuth2WebServer#request-parameter-access_type>
> parameter
> is set to "offline" in your request? The refresh token is only returned if
> your application sets the access_type parameter to "offline" in the initial
> request to Google's authorization server when using Web application type
> credentials. Refresh tokens are always returned for installed applications,
> which is the reason you were receiving the refresh token when testing on
> localhost with an Installed application type credential. Please try this
> out and let me know if you are able to generate a refresh token.
>
> The customerId will not be returned in the response from the OAuth server
> when you generate a refresh token. Instead, you need to make a
> CustomerService.getCustomers()
> <https://developers.google.com/adwords/api/docs/reference/v201609/CustomerService#getcustomers>
>
> request like you do in the code snippet in your earlier post.
>
> To retrieve the email address, you need to include the scope: "
> https://www.googleapis.com/auth/userinfo.email" as mentioned in this
> <https://developers.google.com/identity/protocols/googlescopes#oauth2v2>
> document.
> If this scope is included while you generate the refresh token, you should
> be able to get the email address of the authenticating user by making the
> following request:
>
> https://www.googleapis.com/oauth2/v2/userinfo?access_token=
> "YOUR_ACCESS_TOKEN".
>
>
> You can try this out in the API explorer
> <https://developers.google.com/apis-explorer/#p/oauth2/v2/oauth2.userinfo.get>
> .
>
> Regards,
> 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 [email protected]
To unsubscribe from this group, send email to
[email protected]
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 [email protected].
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/def97840-a6e1-4bc9-b713-e5d0bb4fbb61%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.