Closed chitranjan17 closed 3 years ago
any update on this? I'm having same issue with Netsuite, in Postman it works fine.
@chitranjan17 & @Serber92 have you guys found any solution for this? I'm also stuck at this(using react native). Please let me know.
please show the code
@ddo hey, thanks for the response. Please have a look at the below code:
const Crypto = require('crypto-js');
const OAuth = require('oauth-1.0a')
const oauth = OAuth({ consumer: { key: 'MY_KEY', secret: 'MY_SECRET_KEY', }, signature_method: 'HMAC-SHA256', hash_function(base_string, key) { return Crypto.HmacSHA256(base_string, key).toString(CryptoJS.enc.Base64) }, })
const request_data = { url: 'URL', method: 'POST', // data: { status: 'Hello Ladies + Gentlemen, a signed OAuth request!' }, }
// Note: The token is optional for some requests
const token = { key: 'MY_TOKEN_KEY, secret: 'MY_TOKEN_SECRET', }
fetch('URL', { method: 'POST', headers: oauth.toHeader(oauth.authorize(request_data, token)), }).then((response) => {response.json()) .then((responseJson) => {}) .catch((error) => {});
But i'm getting 401 status from the API.
I also tried using "react-native-crypto" to generate signture but, it is throwing errors related to the package and shim file(even after importing it in the code). Please let me know the correct way, if I'm missing out something.
@chitranjan17 & @Serber92 have you guys found any solution for this? I'm also stuck at this(using react native). Please let me know.
Please check with the time zone you are appending with the request if it not match with NS server you get this error.
any update on this? I'm having same issue with Netsuite, in Postman it works fine.
Please check with the time zone you are appending with the request if it not match with NS server you get this error.
I have this issue of time zone mismatch , so it resolve in my case
@chitranjan17 thanks
@chitranjan17 & @Serber92 have you guys found any solution for this? I'm also stuck at this(using react native). Please let me know.
Please check with the time zone you are appending with the request if it not match with NS server you get this error.
@chitranjan17 hey, using oauth-1.0a the authorization parameters are generated by the library itself including the timestamp. So, if I switch to crypto-js then I can create all the necessary autorization parameters from my end in which case I'm creating timestamp like this(in EST):
var timeZoneOffset = 300; // Eastern Standard Time
var sameDate = (new Date(((new Date()) - (timeZoneOffset * 60 * 1000)))).toISOString()
let timestamp = new Date(sameDate).getTime()
But, still the NS server is throwing 400 status.
Can you please provide me a working example of this?
Will you please check with the mobile setting what time zone you are using? may be this mismatch with NS time zone.
On Fri, 30 Apr 2021 at 17:14, AxayDixit @.***> wrote:
@chitranjan17 https://github.com/chitranjan17 & @Serber92 https://github.com/Serber92 have you guys found any solution for this? I'm also stuck at this(using react native). Please let me know.
Please check with the time zone you are appending with the request if it not match with NS server you get this error.
@chitranjan17 https://github.com/chitranjan17 hey, using oauth-1.0a the authorization parameters are generated by the library itself including the timestamp. So, if I switch to crypto-js then I can create all the necessary autorization parameters from my end in which case I'm creating timestamp like this(in EST): var timeZoneOffset = 300; // Eastern Standard Time var sameDate = (new Date(((new Date()) - (timeZoneOffset 60 1000)))).toISOString() let timestamp = new Date(sameDate).getTime()
But, still the NS server is throwing 400 status.
Can you please provide me a working example of this?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ddo/oauth-1.0a/issues/103#issuecomment-830037114, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIE4QISLWMSHWXPJKDHN5TDTLKJYBANCNFSM4XOLZUIA .
Hi I am using oath plugin in our ionic 1 app but getting Login authentication issue of invalid attempt 403 while validating with Netsuite Server . As authorisation header some time not generated proper in some of android device as attach in the screen shots. Please help Me to fixed this issue or what could be possible reason for it.