[GH-ISSUE #58] Help getting instagram profile data #38

Closed
opened 2026-03-03 16:45:02 +03:00 by kerem · 6 comments
Owner

Originally created by @hopye on GitHub (May 2, 2015).
Original GitHub issue: https://github.com/OAuthSwift/OAuthSwift/issues/58

How can i get the users's profile data ? Username, id , etc..

In instagram theres no end like /user/me .

Instagram sends the profile info in the authentication process

Originally created by @hopye on GitHub (May 2, 2015). Original GitHub issue: https://github.com/OAuthSwift/OAuthSwift/issues/58 How can i get the users's profile data ? Username, id , etc.. In instagram theres no end like /user/me . Instagram sends the profile info in the authentication process
kerem closed this issue 2026-03-03 16:45:02 +03:00
Author
Owner

@zavada commented on GitHub (May 2, 2015):

You can find the example of api request in ViewController.swift. Look into func doOAuthInstagram().

let url :String = "https://api.instagram.com/v1/users/1574083/?access_token=\(credential.oauth_token)"
            let parameters :Dictionary = Dictionary<String, AnyObject>()
            oauthswift.client.get(url, parameters: parameters,
                success: {
                    data, response in
                    let jsonDict: AnyObject! = NSJSONSerialization.JSONObjectWithData(data, options: nil, error: nil)
                    println(jsonDict)
                }, failure: {(error:NSError!) -> Void in
                    println(error)
            })

Just change url in the get request.

<!-- gh-comment-id:98272757 --> @zavada commented on GitHub (May 2, 2015): You can find the example of api request in ViewController.swift. Look into func doOAuthInstagram(). ``` let url :String = "https://api.instagram.com/v1/users/1574083/?access_token=\(credential.oauth_token)" let parameters :Dictionary = Dictionary<String, AnyObject>() oauthswift.client.get(url, parameters: parameters, success: { data, response in let jsonDict: AnyObject! = NSJSONSerialization.JSONObjectWithData(data, options: nil, error: nil) println(jsonDict) }, failure: {(error:NSError!) -> Void in println(error) }) ``` Just change url in the get request.
Author
Owner

@gabriel-jones commented on GitHub (May 2, 2015):

Also, documentation on Instagram (you can see the console here: https://instagram.com/developer/api-console/) shows that a request would be to "https://api.instagram.com/v1/users/self" for the data of the person who logged in, or a specific ID in place of 'self' would retrieve data for that user.

<!-- gh-comment-id:98272964 --> @gabriel-jones commented on GitHub (May 2, 2015): Also, documentation on Instagram (you can see the console here: https://instagram.com/developer/api-console/) shows that a request would be to "https://api.instagram.com/v1/users/self" for the data of the person who logged in, or a specific ID in place of 'self' would retrieve data for that user.
Author
Owner

@hopye commented on GitHub (May 9, 2015):

omg.. i didn't know instagram had a users/self !@@ ill check that right now!! thnx!

<!-- gh-comment-id:100557768 --> @hopye commented on GitHub (May 9, 2015): omg.. i didn't know instagram had a users/self !@@ ill check that right now!! thnx!
Author
Owner

@hopye commented on GitHub (May 10, 2015):

i got it!, How can i send a deauthententicate to instagram, like... the user wants to log out..

<!-- gh-comment-id:100567080 --> @hopye commented on GitHub (May 10, 2015): i got it!, How can i send a deauthententicate to instagram, like... the user wants to log out..
Author
Owner

@ejpusa-zz commented on GitHub (Jul 1, 2015):

You may want to look into SwiftyJSON. Makes JSON parsing super simple, and that gets you pretty much everything from your IG response object.

https://github.com/SwiftyJSON/SwiftyJSON/tree/master

<!-- gh-comment-id:117645298 --> @ejpusa-zz commented on GitHub (Jul 1, 2015): You may want to look into SwiftyJSON. Makes JSON parsing super simple, and that gets you pretty much everything from your IG response object. https://github.com/SwiftyJSON/SwiftyJSON/tree/master
Author
Owner

@phimage commented on GitHub (Aug 8, 2015):

@hopye please close this issue, initial question has been answered

for a new question new issue but I can try to repond.
The User doesn't logout, its just you that do not use the token anymore
There is no "revoke token" currently in instagram api ( https://instagram.com/developer/authentication/ ) to invalidate token and maybe no expiration time that can be specified by you

<!-- gh-comment-id:129045488 --> @phimage commented on GitHub (Aug 8, 2015): @hopye please close this issue, initial question has been answered for a new question new issue but I can try to repond. The User doesn't logout, its just you that do not use the token anymore There is no "revoke token" currently in instagram api ( https://instagram.com/developer/authentication/ ) to invalidate token and maybe no expiration time that can be specified by you
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#38
No description provided.