what if i want to change the authorization to o au...
# ask-stanley-ai
n
what if i want to change the authorization to o auth 2 not a bearer in suitescript 2 and give a sample for how the credentials will look like var reqInformaHeaders = { "Content-Type": "application/json", Authorization: "Bearer " + token, }; var informaRes = https.post({ url: "https://5729924-sb1.restlets.api.netsuite.com/app/site/hosting/restlet.nl?script=537&deploy=1", body: JSON.stringify(reqInformaBody), headers: reqHeaders, });
c
AI generated answer (using internal Slack threads):
To change the authorization to OAuth 2.0 in SuiteScript 2.0, you would need to modify the headers in your request. Instead of using a bearer token, you would use the OAuth 2.0 token. Here's an example of how the headers might look:
Copy code
javascript
var reqInformaHeaders = {
  "Content-Type": "application/json",
  Authorization: "OAuth " + token,
};
The rest of your request would remain the same:
Copy code
javascript
var informaRes = <http://https.post|https.post>({
  url: "<https://5729924-sb1.restlets.api.netsuite.com/app/site/hosting/restlet.nl?script=537&deploy=1>",
  body: JSON.stringify(reqInformaBody),
  headers: reqInformaHeaders,
});
Please note that the token used in the Authorization header should be the OAuth 2.0 token obtained from the OAuth 2.0 authorization server. ****** Disclaimer: This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes. ******
Slack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.859245121
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.857895
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.856846273
Please provide your feedback on this answer.