I am using above URL to Get Auth code .I got redirected to Log iog in page after login I get AUTH code. which I copy to get Token but it wont work and send authorization error as told in earlier thread, verify the URL is correct. and I am getting correct auth code eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhcHBfaWQiOiJOMDZRTzVHQVhNIiwidXVpZCI6IjhkZDBiYTk2NDUyOTRjZTg4NGQwOTY2NTJlY2ExODEzIiwiaXBBZGRyIjoiIiwibm9uY2UiOiIiLCJzY29wZSI6IiIsImRpc3BsYXlfbmFtZSI6IkZTMTk3NCIsIm9tcyI6IksxIiwiaHNtX2tleSI6IjhmZTdhMmYxZDAwMGI4MWJhYjQyMWExOTZlZDM5Y2QwNWM0OTE4OTZiZDBkODc2N2E1NzFjNzQ3IiwiaXNEZHBpRW5hYmxlZCI6Ik4iLCJpc010ZkVuYWJsZWQiOiJOIiwiYXVkIjoiW1wiZDoxXCIsXCJkOjJcIixcIng6MFwiLFwieDoxXCIsXCJ4OjJcIl0iLCJleHAiOjE3NjczNjY2OTAsImlhdCI6MTc2NzMzNjY5MCwiaXNzIjoiYXBpLmxvZ2luLmZ5ZXJzLmluIiwibmJmIjoxNzY3MzM2NjkwLCJzdWIiOiJhdXRoX2NvZGUifQ.7XTbqbPwo-K0rviXXG-LOom_TKgR33fhHA4_qnDAxPA
I use this code within few mins FYI…I am creating webhook from Trading view to Fyers API personal APP
I am using above URL to get auth code.After running the URL in browswer it taken to Fyers login page and authenticate and then send auth code which I quicly copy and use for Token genration but agets above authorization error .check the URL is correct and below auth code format is corect which I get to use for Token genration .Auth code eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhcHBfaWQiOiJOMDZRTzVHQVhNIiwidXVpZCI6ImM3OGViZjFlODZlODRlOTBiMGRlNjM1ZTNlMWVlYjYxIiwiaXBBZGRyIjoiIiwibm9uY2UiOiIiLCJzY29wZSI6IiIsImRpc3BsYXlfbmFtZSI6IkZTMTk3NCIsIm9tcyI6IksxIiwiaHNtX2tleSI6IjhmZTdhMmYxZDAwMGI4MWJhYjQyMWExOTZlZDM5Y2QwNWM0OTE4OTZiZDBkODc2N2E1NzFjNzQ3IiwiaXNEZHBpRW5hYmxlZCI6Ik4iLCJpc010ZkVuYWJsZWQiOiJOIiwiYXVkIjoiW1wiZDoxXCIsXCJkOjJcIixcIng6MFwiLFwieDoxXCIsXCJ4OjJcIl0iLCJleHAiOjE3NjczNzI0MDksImlhdCI6MTc2NzM0MjQwOSwiaXNzIjoiYXBpLmxvZ2luLmZ5ZXJzLmluIiwibmJmIjoxNzY3MzQyNDA5LCJzdWIiOiJhdXRoX2NvZGUifQ.5W5SFqgbYkCgErtIYAHz5s2Rfd9V1Yve31iUIEClEbk
I am creating webhook to connect Trading view logic to connect with Fryers App for trading.
I am crating webhook for trading between trading view and my Fyers API app using Fyers App. I use below URL to get Auth code after getting auth code immediately I trigger logic to get Token thats when I get the AUth error as above .
the token gets changed at every 30 secs.. so if you get it at 27/28 secs, and by the time you retrieve and send it to authentication URl, it might have expired… if not done already, make some code changes that will wait for few secs before getting TOTP key, if the time is between 25-30secs or 55-60secs
Hi @ankit_prajapati1
We would like to inform you that the authorization token is valid for 5 minutes so it does not expire every 30 seconds during the authentication process.
I have generated auth code 10 to 15 times after that only I am sending this issue and read documents 5 times. The issue comes while generating the Token which is second step. Please check the URL given above which generates auth code and below one for Token. After authcode generation instantly I try to create Token but it fails and gave the auth error. Though I am sending correct authcode,secretid and app id. using this curl curl.exe -X POST “https://api-t1.fyers.in/api/v3/token” -H “Content-Type: application/json” -d ‘{ “grant_type”: “authorization_code”, “appIdHash”: “708f631a17…”, “code”: “eyJhbGc…” }’ Please try this one to generate Token
There are no issues in generating the auth code. This issue could be from your side, please DM your client ID so we can check it in detail.
Also, please make sure that your APP ID is activated ( by accepting the usage and required permissions). If it’s not activated also, you may get this error.
Regarding the TradingView webhook, you can use FYERS Automate (our new product) to trigger your automation logic via webhooks.
and I am able to generate AUTH code .Problem is in Token generation. curl.exe -X POST “https://api-t1.fyers.in/api/v3/token” -H “Content-Type: application/json” -d ‘{ “grant_type”: “authorization_code”, “appIdHash”: “708f631a17…”, “code”: “eyJhbGc…” }’ Please try this one to generate Token