'ngenius-payments payment return - message": "Bad Request
When I am calling the API for generating token retune code like this
https://docs.ngenius-payments.com/reference/request-an-access-token-direct
{
"message": "Bad Request",
"code": 400,
"errors": [
{
"message": "Bad token request",
"localizedMessage": "Bad token request",
"errorCode": "badTokenRequest",
"domain": "identity"
}
]
}
Solution 1:[1]
I've encountered the same problem as you recently.
I was missing the "realmName" parameter in the body of my request :
const fetch = require("node-fetch");
const ORABANK_API_KEY = process.env.ORABANK_API_KEY;
const ORABANK_REALM_NAME = process.env.ORABANK_REALM_NAME;
const tokenGet = async () => {
try {
const options = {
method: "POST",
headers: {
Accept: "application/vnd.ni-identity.v1+json",
Authorization: `Basic ${ORABANK_API_KEY}`,
"Content-Type": "application/vnd.ni-identity.v1+json",
},
body: `{"realmName": "${ORABANK_REALM_NAME}"}`,
};
const { access_token } = await fetch(
"https://api-gateway.sandbox.ngenius-payments.com/identity/auth/access-token",
options
).then((response) => response.json());
} catch (e) {
console.log(e);
}
};
module.exports = tokenGet;
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | garlic-lover |