Unable to go pass first part of login on example code

  1. I am using example code in python. I am not getting auth code in redirect uri.

  2. What is client ID? The app id XXXXX-100 or YYYY_XXXXX-100 where YYYY is my user id. I tried both but it is not working.

# Import the required module from the fyers_apiv3 package

from fyers_apiv3 import fyersModel

# Replace these values with your actual API credentials

client_id = "G5FXXXXXX-100" # Format: "Client_ID_XXXXXX"

secret_key = "OBXXXXXX"

redirect_uri = "https://trade.fyers.in/api-login/redirect-uri/index.html"

response_type = "code"

state = "sample_state"

# Create a session model with the provided credentials

session = fyersModel.SessionModel(

client_id=client_id,

secret_key=secret_key,

redirect_uri=redirect_uri,

response_type=response_type

)

# Generate the auth code using the session model

response = session.generate_authcode()

# Print the auth code received in the response

print(response)

I get response as

https://api-t1.fyers.in/api/v3/generate-authcode?client_id=G5FXXXXXX-100&redirect_uri=https%3A%2F%2Ftrade.fyers.in%2Fapi-login%2Fredirect-uri%2Findex.html&response_type=code&state=None

What is wrong?

1 reply