How to access a restlet url using OAuth 2.0 in pos...
# suitetalkapi
s
How to access a restlet url using OAuth 2.0 in postman . Please guide me the steps or send any doc that I could refer . Thanks in advance
b
did you have a refresh and access token?
s
Access token
b
access tokens dont last long
but if you used postman to get the token, you should be able to select the token in the authorization settings of the request
if you got the token outside of postman's oauth 2.0 configuration, then you need to manually set the OAuth 2.0 Authorization Header
s
Hey @battk thanks for the input mate. Where do I find auth URL and Access token URL.?
urls are in step 1 and 2
🙏 1
j
Check this SuiteAnswer https://netsuite.custhelp.com/app/answers/detail/a_id/92502/kw/postman%20oauth%202.0 It Explains how to setup you postman
s
its showing invalid login attempt ! @battk @jimmy
i ve done all steps to get the code in postman as mentioned in https://netsuite.custhelp.com/app/answers/detail/a_id/92502/kw/postman%20oauth%202.0.
b
did you successfully get a refresh token and access token
s
1. I ve created role with oauth 2.0 permissions and added the role to the user. 2. created integration record and got client id and client secret. 3. also enabled corresponding features for outh2.0 in setup 4. in postman i chose oauth2.0 authorisation and filled up these details attached in the picture . 5 . clicked get accesss token button . 6. it asked for login , password , when i entered the credentials , there comes the notice 'invalid login attempt'
no @battk i didnt get the access token , on the way to get that i encountered this login invalid issue !
what am i missing or doing wrong?
b
and the other settings?
Add auth data to?
Header Prefix
Client Authentication
s
@battk
add auth data to
: request header .
header prefix
: Bearer .
Client Authentication
: Send as basic auth header
b
try not authorizing in the browser
s
then what should be the call back url i should use>
?
b
the same, postman intercepts whatever
s
great! ,got it mate . access token , refresh token
b
you should be able to select that token for authorization to your restlet now
s
mate @battk, ive taken the access token from there . added another request in postman and pasted the restlet url . in header i chose authorization : bearer 'access token ' and clicked send . its working ! status 200 ok.
b
postman should offer an option to store the token for you
on your restlet request, you should be able to choose OAuth 2.0 as the authorization type and select the current token to use
s
yeah crct . i tried to use the saved token in theat api request , it showed error 404
b
you can try using the login audit trail's detail column to see what you did wrong
but otherwise you probably have enough to get started
the access token last an hour before you need to get a new one using the refresh token
the refresh token last 7 days before you need to to start over and get a new refresh and access token
s
thats great mate ! thanks for all the inputs , really helped a lot to get started!
This is what i get when i use the access token in the same request "code": "SSS_INVALID_SCRIPTLET_ID",         "message": "That Suitelet is invalid, disabled, or no longer exists."
b
did you change the
Add auth data to?
  
Header Prefix
s
but when i use the another request with
authoization
: bearer 'access token' , the same restlet works fine and getting 200 Ok
mate @battk! got it right this time . Its working fine there too. great!🙏