Hi Team , I am Trying to Generate the access Code But Always Getting Error

Hi Team, I am Trying to Generate Code as per Docs Using OAuth 2.0 and trying to Authorize. But every time I do I get an error Message.
Please Guide where I am doing Wrong.
The error message which I am getting is “{“status”:“error”,“errors”:[{“errorCode”:“UDAPI100016”,“message”:“Invalid Credentials”,“propertyPath”:null,“invalidValue”:null,“error_code”:“UDAPI100016”,“property_path”:null,“invalid_value”:null}]}”

My Code Snippet. Please let me know where I entered incorrect endpoints.

@Daisy Invalid credentials are typically a result of incorrect or mismatched values provided for the following fields. Please review the values for the fields listed below:

  • code
  • client_id
  • client_secret
  • redirect_uri
  • grant_type (Should be set to “authorization_code”)

Here’s a sample cURL request for obtaining an access token:

curl --location 'https://api-v2.upstox.com/login/authorization/token' \
--header 'accept: application/json' \
--header 'Api-Version: 2.0' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'code={your_auth_code}' \
--data-urlencode 'client_id={your_client_id}' \
--data-urlencode 'client_secret={your_client_secret}' \
--data-urlencode 'redirect_uri={your_callback_url}' \
--data-urlencode 'grant_type=authorization_code'

Please make sure that the values you provide for these fields are accurate and correctly match the expected values for your authentication process.

Hi @Pradeep_Jaiswar
I am not able to Get the Auth Code. Even After SucessFull Authorization.
Is There a scope For Different ways to access it so Code can be an optional Parameter?
Because if I manually enter the code and run Integration I am able to get the access Code. Need to Get On a Click.
Or let me know if an access Token can be Consumed For all Operations Without Ouath 2.0 Code .


I’m also facing the same issue even after giving all the correct details. Sample code(instead of curl request) for how to get access_token would be great.

@Daisy were you able to solve the issue?