unable to generate access token

Hello,

I am able to generate an auth_code successfully using the Fyers OAuth login URL, but when I try to exchange the auth_code for an access_token using the API, I consistently receive:

code: -441, message: "invalid grant type"

I have:
• Set a valid HTTPS Redirect URL
• Regenerated my Secret Key
• Used a fresh auth_code
• Matched the redirect URI in both login and token exchange

Please check if my app or account has any restriction on token generation or if there is any change in OAuth requirements.

My App Name: ramanfyertrading

**
**

**
**

**code i used is **

**
**

Regenerate fyers token

from fyers_api import fyersModel

CLIENT_ID = “xxxxxx”
SECRET_KEY = “xxxxxxx”
REDIRECT_URI = "https://wefocusclasses.com/"
RESPONSE_TYPE
= “code”
STATE = “state123”

session = fyersModel.SessionModel(
client_id=CLIENT_ID,
secret_key=SECRET_KEY,
redirect_uri=REDIRECT_URI,
response_type=RESPONSE_TYPE,
state=STATE
)

auth_url = session.generate_authcode()
print(“\nOpen this URL in Chrome:\n”)
print(auth_url)

auth_code = input("\nPaste auth code here: ").strip()

session.set_token(auth_code)
response = session.generate_token()

print(“\nFULL RESPONSE FROM FYERS:”)**
**

Thank you.

KALARAMAN

Hi @115783877766807194377,

Sorry for the inconvenience.

It looks like the system considering an invalid auth code. Please DM your client ID so we can check this further.

My issue has been resolved.

Thanks Fyers Team

Thanks for confirming.