How to resolve the error mentioned below UDAPI100057

{‘status’: ‘error’, ‘errors’: [{‘errorCode’: ‘UDAPI100057’, ‘message’: ‘Invalid Auth code’, ‘propertyPath’: None, ‘invalidValue’: None, ‘error_code’: ‘UDAPI100057’, ‘property_path’: None, ‘invalid_value’: None}]}

Could you provide the specific curl command you’re using for your request?

Based on the error message, it seems clear that the authentication code is invalid. It’s important to remember that the authentication code can only be used once, as indicated in the note section of the authentication guide here: Authentication | Upstox Developer API

Hi Pradeep,

I am also getting same error while requesting for token in both Python SDK and also curl. What is happening

/usr/local/bin/python3.9 /Users/ravikumarn/Development/Upstox/Initiate_request.py
{‘status’: ‘error’, ‘errors’: [{‘errorCode’: ‘UDAPI100057’, ‘message’: ‘Invalid Auth code’, ‘propertyPath’: None, ‘invalidValue’: None, ‘error_code’: ‘UDAPI100057’, ‘property_path’: None, ‘invalid_value’: None}]}

curl -L -X POST ‘https://api.upstox.com/v2/login/authorization/token
-H ‘Content-Type: application/x-www-form-urlencoded’
-H ‘Accept: application/json’
–data-urlencode ‘code=some_code’
–data-urlencode ‘client_id=client_code’
–data-urlencode ‘client_secret=client_secret’
–data-urlencode ‘redirect_uri=https://127.0.0.0
–data-urlencode ‘grant_type=authorization_code’

I’m also having this problem {“status”:“error”,“errors”:[{“errorCode”:“UDAPI100060”,“message”:“Resource not Found.”,“propertyPath”:null,“invalidValue”:null,“error_code”:“UDAPI100060”,“property_path”:null,“invalid_value”:null}]} .

I’m using nodeJS
And this’s my code block

const express = require(“express”);
const axios = require(“axios”);
const app = express();

const API_KEY = “”;
const API_SECRET = “”;
const REDIRECT_URI = “”;

app.get(“/”, (req, res) => {
const authorizationUrl = https://api-v2.upstox.com/index/dialog/authorize?apiKey=${API_KEY}&redirect_uri=${REDIRECT_URI}&response_type=code;
console.log(“Authorization URL:”, authorizationUrl);
res.redirect(authorizationUrl);
});

app.get(“/callback”, async (req, res) => {
const code = req.query.code;
console.log(“Authorization code received:”, code);

if (!code) {
console.error(“Authorization code not found”);
return res.send(“Authorization code not found”);
}
try {
const response = await axios.post(
https://api.upstox.com/v2/login/authorization/token”,
{
client_id: API_KEY,
client_secret: API_SECRET,
code: code,
redirect_uri: REDIRECT_URI,
grant_type: “authorization_code”,
},
{
headers: {
“Content-Type”: “application/json”,
},
}
);
console.log(“Response from token endpoint:”, response.data);
const accessToken = response.data.access_token;
res.send(Access token: ${accessToken});
} catch (error) {
console.error(“Error obtaining access token:”, error.response.data);
res.send(“Error obtaining access token”);
}
});

app.listen(8000, () => {
console.log(“Server running at http://127.0.0.1:8000”);
});

Could you please provide your Upstox user ID for further investigation? Additionally, it would be helpful if you could mention the time when you encountered this error.

already solved that problem.

bro can you guide me how you did it, i am also facing same problem, can we connect over whatsapp or insta or telegram, if its ok.

I am also facing the same error. Got the response when calling /login/authorization/token with nececssary parameter immediately after accesing the auth code using authorization/dialog api method. But when I referesh the page and then if I have the code then trying to access token directly at that time it throws above mentioned error with messagge as Invalid Auth Code.

Any one has solution then please do share