Salesforce OAuth2 missing_oauth_token

2.1k views Asked by At

I am doing all the steps to gain an oauth token for salesforce but unable to workout the final step. I want to gather the Users information (email, first name, lastname, thumbnail).

So I get to the step where I can get this information :

<OAuth>
<id>
   https://login.salesforce.com/id/00D90000000qdxPEAQ/00590000001hbAyAAI
</id>
<issued_at>1386648423427</issued_at>
<scope>id chatter_api</scope>
<instance_url>https://ap1.salesforce.com</instance_url>
<signature>YlnejSL3ZKkSmbnt916sLZuzt13UNUFGi+kGCjU7ql0=</signature>
<access_token>
00D90000000qdxP!AQsAQIcR.oo6y.EDuf3B4fzctQ2e7DK0L1kGjgxGSl.dBgetu3lUbZp.VDZjSIi7O1LXmTMWFZmOJVeRS.IQfvPL8VmhxLaC
</access_token>
</OAuth>

but from here, I am not sure how to get the users information (returned as XML or JSON). From a browser, can't I go to https://login.salesforce.com/id/00D50000000IZ3ZEAW/00550000001fg5OAAQ followed by some auth key? (I dont have CURL installed).

Whenever I try go to this in the URL it states

   Missing_OAuth_Token
2

There are 2 answers

0
superfell On

You are on the right tracks, you can do a GET on the id URL, but you need to supply the access token in the Authorization header, e.g. Authorization: Bearer {accessToken}

0
Owen Cao On

I used to develop something using Google OAuth,so I tried request like https://login.salesforce.com/id/00D50000000IZ3ZEAW/00550000001fg5OAAQ?access_token=access_token(this format is supported by Google OAuth), but unfortunately I get response "Missing_OAuth_Token", just like what you did. Then I refer to salesforce document, and found that it only support the format like:

curl https://instance_name.salesforce.com/services/data/v20.0/ -H 'Authorization: Bearer access_token'

You need to put access_token in the header of the request, so install CURL, or send the request in your program with access_token in header.