You need to sign in to do that
Don't have an account?

'Missing_OAuth_Token' response while making rest callout using OAuth Endpoints
Hi All,
I wanted to get user info detail by using the salesforce OAuth Apex Callout . I have the access token in my previous step. Now I am setting the end point url with oauth_token parameter as below:
HttpRequest request = new HttpRequest();
request.setMethod('GET');
request.setTimeout(60000);
String endpoint = 'https://login.salesforce.com/services/oauth2/userinfo?oauth_token='+accessToken;
request.setEndpoint(endpoint);
HttpResponse response = new Http().send(request);
I am getting the response body as :Missing_OAuth_Token "System.HttpResponse[Status=Forbidden, StatusCode=403]".
referred documentation: https://help.salesforce.com/articleView?id=remoteaccess_using_userinfo_endpoint.htm&type=0
Please help.
Thanks in Advance!!!
I wanted to get user info detail by using the salesforce OAuth Apex Callout . I have the access token in my previous step. Now I am setting the end point url with oauth_token parameter as below:
HttpRequest request = new HttpRequest();
request.setMethod('GET');
request.setTimeout(60000);
String endpoint = 'https://login.salesforce.com/services/oauth2/userinfo?oauth_token='+accessToken;
request.setEndpoint(endpoint);
HttpResponse response = new Http().send(request);
I am getting the response body as :Missing_OAuth_Token "System.HttpResponse[Status=Forbidden, StatusCode=403]".
referred documentation: https://help.salesforce.com/articleView?id=remoteaccess_using_userinfo_endpoint.htm&type=0
Please help.
Thanks in Advance!!!
In the case of StatusCode = 403, The request has been refused. Verify that the logged-in user has appropriate permissions.
OR
Try the below code to get access once I got the JSON response parsed to get Access Token
Thanks
Mukesh Kumar
Thanks for the reply. I have tried the code provided ,it didn't work for me. And I am not sure about the user permission as the logged in user is a system admin.
curl https://login.salesforce.com/services/data/v20.0/ -H 'Authorization: Bearer access_token'
You need to put access_token in the header of the request,
PS : for a reason it is always advised to test api first on POSTMAN... there are many benefits... one being that postman itself generates the post scripts in various languages .. javaScript/c#/php/ curl