[GH-ISSUE #179] Retrieving Instagram user data along side access token #107

Closed
opened 2026-03-03 16:45:44 +03:00 by kerem · 3 comments
Owner

Originally created by @cameronbarker on GitHub (Jan 30, 2016).
Original GitHub issue: https://github.com/OAuthSwift/OAuthSwift/issues/179

I see from Instagram that when you authenticate it returns the information below. Is there a way to get the user data along side the access token initially using OAuthSwift?

{
    "access_token": "fb2e77d.47a0479900504cb3ab4a1f626d174d2d",
    "user": {
        "id": "1574083",
        "username": "snoopdogg",
        "full_name": "Snoop Dogg",
        "profile_picture": "..."
    }
}
Originally created by @cameronbarker on GitHub (Jan 30, 2016). Original GitHub issue: https://github.com/OAuthSwift/OAuthSwift/issues/179 I see from Instagram that when you authenticate it returns the information below. Is there a way to get the user data along side the access token initially using OAuthSwift? ``` json { "access_token": "fb2e77d.47a0479900504cb3ab4a1f626d174d2d", "user": { "id": "1574083", "username": "snoopdogg", "full_name": "Snoop Dogg", "profile_picture": "..." } } ```
kerem 2026-03-03 16:45:44 +03:00
Author
Owner

@phimage commented on GitHub (Jan 30, 2016):

success callback have third parameters, the last one 'parameters' I think contains the data you want

<!-- gh-comment-id:177294984 --> @phimage commented on GitHub (Jan 30, 2016): success callback have third parameters, the last one 'parameters' I think contains the data you want
Author
Owner

@cameronbarker commented on GitHub (Jan 30, 2016):

@phimage Took a look and only found the "access_token" and "state" keys in the returned "parameters" dictionary

<!-- gh-comment-id:177296420 --> @cameronbarker commented on GitHub (Jan 30, 2016): @phimage Took a look and only found the "access_token" and "state" keys in the returned "parameters" dictionary
Author
Owner

@phimage commented on GitHub (Feb 9, 2016):

To get this information you must not use the "token" type authentification but the "code"

accessTokenUrl: "https://api.instagram.com/oauth/access_token",
responseType:   "code"

you will receive in the response parameters a json string into "user" index
decode it with NSJSONSerialization or any third party json framework

<!-- gh-comment-id:181830794 --> @phimage commented on GitHub (Feb 9, 2016): To get this information you must not use the "token" type authentification but the "code" ``` swift accessTokenUrl: "https://api.instagram.com/oauth/access_token", responseType: "code" ``` you will receive in the response parameters a json string into "user" index decode it with `NSJSONSerialization` or any third party json framework
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/OAuthSwift#107
No description provided.