Calling external appsusing bearer token - netsuite

I tried calling an external url using bearer token but i got 401 response.I want to connect external url from netsuite using bearer token.
I created a suitele, in post I am trying to connect external url using bearer token

Related

POST request for GMAIL API wont go through

I am using the gmail API and I'm trying to do a POST request for the watch user endpoint ( https://developers.google.com/gmail/api/reference/rest/v1/users/watch ).
I'm doing it on postman by usnig this URL which I need and inside of headers I add the auth and it's code.
POST REQUEST TO
https://www.googleapis.com/gmail/v1/users/me/watch
Headers:
Authorization: Bearer secretcode
By sending this request, I'm getting an error of 401 which says "Request had invalid authentication credentials. Expected OAuth 2 access token, login cookie or other valid authentication credential.

What is the best way to handle bearer token from external server/api

Hi, currently I'm new to node.js, I have received the token using routes app.post('/getToken'), then later i need the token to call from the external api to get some data and populate it on the front-end. What is the best way to handle the token that i received from the external api.
are there a better way to only call getToken just once, then i can freely get the data from external api by using the token as long the token is not expired and how should i verified the token ?
You can get the bearer token from your request header like this
let bearerToken = req.headers.authorization;
After that you can pass this token to your external API

Docusign UserInfo endpoint returns 401 Unauthorized when access token is provided

I am integrating my API backend with DocuSign in order to send and retrieve envelopes. I am using the JWT Grant flow.
Authentication options
In the DocuSign development environment, I am able to retrieve an access token using the JWT flow and the Docusign C# SKD.
I need to then call the oauth/userinfo endpoint in order to retrieve the base_uri field to use for making calls to Docusign.
When I make a GET request to https://account-d.docusign.com/oauth/userinfo, including the access token in the Authorization header as Bearer <access_token>, I receive a 401 Unauthorized response, and this message in the body:
{
"error": "internal_server_error",
"reference_id": "<some GUID>"
}
I have tried this using curl, Postman and the C# SDK and all give the same result.
Curl syntax:
curl --header "Authorization: Bearer <access token>" https://account-d.docusign.com/oauth/userinfo
user-info endpoint documentation
JWT flow (step 4)
As far as I can see, I appear to be calling the API according to the documentation and I have set up the account with an RSA key pair which is required for system integrations (created within the Docusign admin portal).
Can anyone think of a reason this could be happening?
Since you're using the C# SDK as you mentioned, you can call this endpoint using the same SDK if you have a valid token.
https://developers.docusign.com/docs/esign-rest-api/sdk-tools/c-sharp/reference/
public OAuth.UserInfo GetUserInfo(string accessToken);
You can confirm that your token is valid by trying to use it for other API calls.
A token from the developer account should be useful to make this call in the developer account only. If you need this for production (typically reason to need the base_uri) then you have to call it with account.docusign.com not account-d.docusign.com.
I have now been able to get the base_uri from UserInfo endpoint using the RequestJWTUserToken method in the C# SDK. Using this token allows me to hit the REST API endpoint.
Both methods appear to hit the same oauth/token endpoint and use the same grant type, only RequestJWTUserToken includes the "sub" claim for the userId.

how to set header method POST via postman when csrf token invalid

How can I set header method POST via postman for a csrf token? I am using postman Version 4.10.7. I am getting the error
ForbiddenError: invalid csrf token
on postman but in the normal test via view on browser it is working.

Auth Token for Azure Web API

I'm having issues with using tokens to access my Azure Web API. I followed this documentation from Microsoft.
I can successfully request an access token by doing a POST request to the authorization token endpoint:
https://login.microsoftonline.com/{Tenant ID}/oauth2/token
My POST body:
client_id:( Web API client ID )
client_secret:( Web API client Secret )
grant_type:password
username:userName
password:*******
resource:sharepoint.com
I'm using POSTMAN to test my calls and when I try to access my API using that returned token from above, I get a 401 unauthorized.
Was a configuration issue inside my WebConfig file.

Resources