GET
/api/v3/generate-authcodeGenerate Auth Code
This API allows you to send a user to the FYERS login page and receive an auth code on your redirect URI.
USE CASE
Start the login for your own FYERS account and receive an auth_code on your redirect_uri.
Details
- Open this URL in the user's browser (a GET request); the user then logs in with their FYERS credentials.
redirect_urimust be the same URL provided at app creation. Example: https://trade.fyers.in/api-login/redirect-uri/index.html.- Send a random
state. The same value is returned after a successful login, so verify it before using the code. - The redirect carries an
auth_code, which you exchange for an access token with Validate Auth Code. - Use a
redirect_urithat is in your control, not a public endpoint such as google.com, because the auth token is sensitive.
Request Attributes
| Attribute | Data Type | Description |
|---|---|---|
client_id | string | This is the app_id which you have received after creating the app. Eg: “qwerty-100” |
redirect_uri | string | This is where the user will be redirected after successful login. Eg: https://trade.fyers.in/api-login/redirect-uri/index.html This should be the same as what was provided at the time of app creation |
response_type | string | This value must always be “code” |
state | string | You send a random value. The same value will be returned after successful login to the redirect uri. Eg: “abcdefg” |
Response Attributes
| Attribute | Data Type | Description |
|---|---|---|
s | string | ok / error |
code | int | This is the code to identify specific responses |
message | string | This is the message to identify the specific error responses |
auth_code | string | String value which will be used to generate the access_token |
state | string | This value is returned as is from the first request |
Last updated on