Hi, I am trying to get Oauth2.0's auth code in sch...
# suitescript
q
Hi, I am trying to get Oauth2.0's auth code in scheduled script, but can't get it. why?
a
If you are connecting to an external endpoint from an Scheduled Script you most likely will need to use promises: • First call to the token endpoint to obtain an access token • Second call uses that token to authenticate.
d
You can’t get an OAuth 2.0 authorization code directly in a scheduled script because it requires a user to log in and grant consent. For automation, the usual approach is to get the code manually once and then use a refresh token, or use a server-to-server OAuth flow that doesn’t require user interaction.