File size: 1,119 Bytes
4aadc81
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import requests

# --- YOUR CREDENTIALS ---
code = "1000.c64b06a0dbcaedf4c8e4035239dde8ee.63f76dfac0c7475254cf1c39711366bd"
client_id = "1000.SIMKGAO5719K0TQ0QZQ31ZU57RLFNQ"
client_secret = "60b329b4fe51930abee900cba6524ec7332cd67e06"
redirect_uri = "http://www.google.com" # This must match what you entered in the console

# --- TRYING INDIAN DATA CENTER (.IN) FIRST ---
# Because your name/currency suggests India. If this fails, change .in to .com
url = "https://accounts.zoho.in/oauth/v2/token" 

data = {
    "code": code,
    "client_id": client_id,
    "client_secret": client_secret,
    "redirect_uri": redirect_uri,
    "grant_type": "authorization_code"
}

print(f"Connecting to {url}...")
response = requests.post(url, data=data)

print("\n--- ZOHO RESPONSE ---")
print(response.text)

if "refresh_token" in response.text:
    print("\nSUCCESS! COPY THIS REFRESH TOKEN 👇")
    print(response.json().get("refresh_token"))
else:
    print("\nFAILED. If error is 'invalid_code', the 10 mins expired or Redirect URI mismatch.")
    print("If error is 'invalid_client', try changing .in to .com in the URL.")