Salesforce: Any API for getting user information?

Assuming you've done OAuth, the OAuth response includes an id field with an Identity Service URL - e.g.:

{
    "id":"https://login.salesforce.com/id/00D50000000IZ3ZEAW/00550000001fg5OAAQ",
    "issued_at":"1296458209517",
    "refresh_token":"5Ae...",
    "instance_url":"https://na1.salesforce.com",
    "signature":"0/1...",
    "access_token":"00D..."
}

GET this URL, passing the access token, and you'll receive the user info. Note the use of -L to follow redirects:

$ curl -L -H 'X-PrettyPrint: 1' -H 'Authorization: Bearer 00D...' https://login.salesforce.com/id/00D50000000IZ3ZEAW/00550000001fg5OAAQ
{
    "id":"https://login.salesforce.com/id/00D50000000IZ3ZEAW/00550000001fg5OAAQ",
    "asserted_user":true,
    "user_id":"00550000001fg5OAAQ",
    "organization_id":"00D50000000IZ3ZEAW",
    "username":"[email protected]",
    "nick_name":"user1.2950476911907334E12",
    "display_name":"Sample User",
    "email":"[email protected]",
    "status":{
        "created_date":"2010-11-08T20:55:33.000+0000",
        "body":"Working on OAuth 2.0 article"
    },
    "photos":{
        "picture":"https://c.na1.content.force.com/profilephoto/005/F",
        "thumbnail":"https://c.na1.content.force.com/profilephoto/005/T"
    },
    "urls":{
        "enterprise":"https://na1.salesforce.com/services/Soap/c/{version}/00D50000000IZ3Z",
        "metadata":"https://na1.salesforce.com/services/Soap/m/{version}/00D50000000IZ3Z",
        "partner":"https://na1.salesforce.com/services/Soap/u/{version}/00D50000000IZ3Z",
        "rest":"https://na1.salesforce.com/services/data/v{version}/",
        "sobjects":"https://na1.salesforce.com/services/data/v{version}/sobjects/",
        "search":"https://na1.salesforce.com/services/data/v{version}/search/",
        "query":"https://na1.salesforce.com/services/data/v{version}/query/",
        "recent":"https://na1.salesforce.com/services/data/v{version}/recent/",
        "profile":"https://na1.salesforce.com/00550000001fg5OAAQ"
    },
    "active":true,
    "user_type":"STANDARD",
    "language":"en_US",
    "locale":"en_US",
    "utcOffset":-28800000,
    "last_modified_date":"2011-01-14T23:28:01.000+0000"
}

More info on the Identity Service.


There is an actual endpoint for this now as well: https://login.salesforce.com/services/oauth2/userinfo

See here for the help document


For Rest API (Force.com-JavaScript-REST-Toolkit), we have created one more API to get current authenticate user information. You can find more details at link

Please let me know in case of any other information required.