Can someone please help setting up a local way of ...
# replication-troubleshooting
g
Can someone please help setting up a local way of getting
google search console
source OAuth credentials:
access
and
refresh
tokens e.g. python code with client. Existing Oauth clients have been affected
October 3, 2022 - the OOB flow is deprecated for OAuth clients created before February 28, 2022
https://developers.google.com/identity/protocols/oauth2/resources/oob-migration
✍️ 1
u
@[DEPRECATED] Marcos Marx turned this message into Zendesk ticket 2749 to ensure timely resolution!
u
Hi! While I look into this more, are you able to authenticate with the service account option?
e
Hi. are you trying to make an oauth2.0 for gg ads api? if so use this:
Copy code
import requests

# get code
url = "<https://accounts.google.com/o/oauth2/v2/auth>?" \
      "client_id=client_id" \
      "&redirect_uri=redirect_uri" \
      "&response_type=code&scope=<https://www.googleapis.com/auth/adwords>" \
      "&include_granted_scopes=true" \
      "&access_type=offline" \
      "&prompt=consent"

payload={}
headers = {
  'Authorization': 'Bearer token'
}

response = requests.request("POST", url, headers=headers, data=payload, timeout=360)

print(response.text)

# get refresh token
import requests

url = "<https://accounts.google.com/o/oauth2/token>?" \
      "client_id=client_id" \
      "&client_secret=client_secret" \
      "&grant_type=authorization_code" \
      "&redirect_uri=redirect_uri" \
      "&access_type=offline" \
      "&prompt=consent"

payload={}
headers = {
  'Content-Type': 'application/x-www-form-urlencoded',
  'Authorization': 'Bearer token'
}

response = requests.request("POST", url, headers=headers, data=payload, timeout=360)

print(response.text)

# get access token
import requests

url = "<https://oauth2.googleapis.com/token>?" \
      "client_id=client_id" \
      "&client_secret=client_secret" \
      "&grant_type=refresh_token" \
      "&redirect_uri=redirect_uri" \
      "&refresh_token=refresh_token" \
      "&access_type=offline" \
      "&prompt=consent"

payload={}
headers = {
  'Content-Type': 'application/x-www-form-urlencoded',
  'Authorization': 'Bearer token'
}

response = requests.request("POST", url, headers=headers, data=payload, timeout=360)

print(response.text)
you can also refer to this doc for the python sdk: https://github.com/googleads/google-ads-python/
u
We've created an issue to keep track of updates and investigate this further: https://github.com/airbytehq/airbyte/issues/17890