Hi All: In Netsuite OAuth2.0 during POST Request ...
# integrations
k
Hi All: In Netsuite OAuth2.0 during POST Request to the Token Endpoint i am frequently getting this error: { "error": "unsupported_grant_type" } Can anybody please help me to resolve this please? Thanks in Advance!
b
share your postman request setup
k
message has been deleted
b
code, redirect_uri and grant_type should be body parameters
with the encoding set to
x-www-form-urlencoded
k
this encoding should be in headers right?
b
there is a dropdown in the body tab to set the encoding
k
ohk got it.
b
Keep in mind that your access token expires in an hour and your refresh token in 7 days
k
Thank you battk! I did the same as you mentioned and now getting this error.
Copy code
{
   error: "invalid_client"
}
b
this is client id and client secret related
make sure you are following the directions in Step 2: POST Request to the Token Endpoint
specifically the parts about the client authentication using basic authentication
k
Thanks Battk! Yes i am going as per Step 2... and to generate Basic authentication i doing like this: encode.convert({string: '<clinetID>:<Client secreate>' ,inputEncoding: encode.Encoding.UTF_8,outputEncoding: encode.Encoding.BASE_64 }); and the returned value i am using in Authentication infront of Basic?
b
you probably want to check that it works in postman first
postman has support for for Basic Authentication
k
yes i am testing in postman only, i have used that api just to get that Base64 string to authenticate, but when using postman i am getting "invalid_grant" error and while using using netsuite script i am getting "invalid_client" i am not understanding how?
b
probably some difference between the two
share how you setup the postman request
k
This screenshot include headers part
and this is body section
b
Content-Type header is wrong in the headers
remove it
im not sure how correct the authorization header is, but you should enter that information in the Authorization tab
you shouldnt have to set any headers manually, they should all be automatically set by postman
k
In postman Authorization tab i have selected Basic Auth but it is asking for credentials?
b
thats where you enter the Consumer Key / Client ID and Consumer Secret / Client Secret from the integration record
k
in Basic Auth it is asking for Email Id and Password?
b
what does this look like?
k
It look like this
b
thats correct
what have you been doing before?
basic authentication is essentially username/password
k
i was sending that Base64 string in headers befor
b
basic authentication consists of a username and password separated by a : encoded with base64, prefixed with Basic, and then put into the Authorization header
the prompt you are seeing automates that process
k
Hi battk, I have successullu executed the OAuth2.0 process in suitelet, Thank u so much for you guidance and support i really appreciate it. Thank u so much!
253 Views