Issue with Access Token Generation

Hi!

I am writing to request assistance with an issue I’m facing while trying to generate an Access Token for my Fyers app in JavaScript.

Despite following the Fyers API documentation and verifying my code multiple times, I consistently encounter the following error when making a POST request to the /access-token endpoint:

“Exception: Request failed for https://api.fyers.in returned code 500. Truncated server response: {‘s’: ‘error’, ‘code’: 500, ‘message’: ‘Invalid Request, please provide valid method’} (use muteHttpExceptions option to examine full response)”

I have ensured that the request method is correctly set to POST, and that all the required parameters (grant_type, code, client_id, secret_key, redirect_uri) are included in the request body with the correct values.

The relevant code snippet is in the attached Txt file.

I have tried regenerating the Auth Code and using different variations of the code, but the error persists.

Could anyone please investigate this issue and provide any guidance or suggestions for resolving it?

Thank you for your time and assistance.

@117743031955998222903

Looks like you are using older v2 API. This is invalid way of generating access token.

Refer Fyers v3 docs - API - FYERS

The access-token fetch url endpoint would be -

https://api-t1.fyers.in/api/v3/validate-authcode

Also, the payload is different which needs to include fresh AuthCode and SHA-256 Hash of your ClientAppId:ClientAppSecret

Hey @117743031955998222903

Please find the correct way of token generation , you can refer to this link for the endpoint :
https://myapi.fyers.in/docsv3#tag/Authentication-and-Login-Flow-User-Apps/paths/~1Authentication%20&%20Login%20Flow%20-%20User%20Apps/get

Hi @WWhYB2qrsx and @nsuyash11-m18

Thanks for your valuable inputs and for pointing me to the V3 API documentation!

In order to get a new Auth Code, I am now trying to implement the authentication process as per the V3 API, but I am getting a 503 error when I try to access the authorization URL (screenshot below*).

I have checked the Fyers API status page, and no ongoing issues are mentioned.

Could you please advise on what might be causing this error and how I can resolve it?

Thank you again!

*Client code is deliberately changed with placeholder for security purposes.

@117743031955998222903
This error appears to be an issue from Fyers side. Wait for some time and try the process again and check if it is still an issue. It is working fine at my end.

Note : Fyers Status page is a joke. Looks like they manually update incidents there if they see/get any reports :sweat_smile: