I try to login automation with selenium we get error came like this {'status': 'error', 'errors': [{'errorCode': 'UDAPI100069', 'message': "Check your 'client_id' and 'client_secret'; one or both are incorrect.", 'propertyPath': None, 'invalidValue': None

this is my python code

import requests as rq
from time import sleep
from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
import urllib.parse as urlparse
import xlwings as xw
from pyotp import TOTP

file_path = r’C:\Users\computer\Documents\TradeToolsUpstox.xlsb’ # Specify the full file path
wb = xw.Book(file_path)
#wb = xw.Book(‘TradeToolsUpstox.xlsb’)
crd = wb.sheets(“Cread”)
api_key = crd[‘B1’].value
secret_key = crd[‘B2’].value
r_url = crd[‘B3’].value
totp_key = crd[‘B4’].value
mobile_no = crd[‘B5’].value
pin = crd[‘B6’].value

#totp=**********************************************

auth_url = f’Login to Upstox
options = webdriver.ChromeOptions()
options.add_argument(‘–no-sandbox’)
#options.add_argument(‘–headless’)
driver = webdriver.Chrome(options=options)
driver.get(auth_url)
wait = WebDriverWait(driver,3)

wait.until(EC.presence_of_element_located((By.XPATH, ‘//[@id=“mobileNum”]'))).send_keys(mobile_no)
wait.until(EC.element_to_be_clickable((By.XPATH, '//
[@id=“getOtp”]’))).click()
totp = TOTP(totp_key).now()
sleep(2)
wait.until(EC.presence_of_element_located((By.XPATH, ‘//[@id=“otpNum”]'))).send_keys(totp)
wait.until(EC.element_to_be_clickable((By.XPATH, '//
[@id=“continueBtn”]’))).click()
sleep(2)
wait.until(EC.presence_of_element_located((By.XPATH, ‘//[@id=“pinCode”]'))).send_keys(pin)
wait.until(EC.element_to_be_clickable((By.XPATH, '//
[@id=“pinContinueBtn”]’))).click()
sleep(1)
token_url = driver.current_url
parsed = urlparse.urlparse(token_url)
driver.close()
code = urlparse.parse_qs(parsed.query)[‘code’][0]
url = ‘https://api-v2.upstox.com/login/authorization/token
headers = {
‘accept’: ‘application/json’,
‘Api-Version’: ‘2.0’,
‘Content-Type’: ‘application/x-www-form-urlencoded’}

data = {
‘code’: code,
‘client_id’: api_key,
‘client_secret’: secret_key,
‘redirect_uri’: r_url,
‘grant_type’: ‘authorization_code’
}

response = rq.post(url, headers=headers, data=data)
jsr = response.json()
print(jsr)

with open(‘accessToken.txt’,‘w’) as file:
file.write(jsr[‘Bearer: access_token’ ])
print(f"Access Token : {jsr[‘Bearer: access_token’ ]}")
any one can help me

It seems there may be an error with either the client ID or the client secret. Please verify your details against those in the app you created to ensure they match.

Additionally, I recommend reviewing the documentation on authentication provided by Upstox at Authentication | Upstox Developer API for a better understanding.

It’s important to note that Upstox does not support or endorse automating the generation of access tokens, in accordance with SEBI and other regulatory guidelines. Users must manually log in once a day, following the designated login processes.

Thank you.

i can not find i was give curect input my code i run code go to the url and auth url and paste mobile number and get totp and paste totp and pin number all done but we can not get the access token