mirror of
https://github.com/OAuthSwift/OAuthSwift.git
synced 2026-04-26 20:55:57 +03:00
[GH-ISSUE #26] Keep user logged #17
Labels
No labels
bug
cocoapod
duplicate
enhancement
feature-request
help wanted
help wanted
invalid
pull-request
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/OAuthSwift#17
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @pistacchio on GitHub (Feb 20, 2015).
Original GitHub issue: https://github.com/OAuthSwift/OAuthSwift/issues/26
Hi,
suppose that I have an app with a Twitter login button. After the login, I'm given back the credentials and I can store them in NSUserDefaults.standardUserDefaults()
If the user runs the app again, and I see that he has auth credentials already set, how can I set up the oauth client so that it uses them without requiring the login again?
Also, once the user it logged in, how to get info of the logged user, such is user id etc?
Thanks
@Niels-P commented on GitHub (Mar 1, 2015):
Okay I found out how to do it.
In the framework file OAuthClientSwift you add this function in the first class
Then in your view controller you add:
That way you can use the token and secret without having to authorize all over again. Remember to check if the token is still valid by checking the LinkedIn response on failure.
@pistacchio commented on GitHub (Mar 2, 2015):
Hi,
yes, I ended up doing something very similar to be able to set the credentials from outside the class. I think this should be added to the project.
@hopye commented on GitHub (Apr 16, 2015):
i have the same questions, im using instagram auth . i do not know how to get the id, and other info instagram provides when authenticating... i took the code from the example...
Instagram only provides that info at authorization only looks like, then you can use the other end points, but theres no https://api.instagram.com/v1/users/myinfo , the /self/feed , returns the feed from the user but no logged user info..
Can someone please point me in the right direction ?
oauthswift.authorizeWithCallbackURL( NSURL(string: "comalacartado://oauth-callback/instagram")!, scope: "likes+comments+basic", state:"INSTAGRAM", success: {
credential, response in
self.showAlertView("Instagram", message: "oauth_token:(credential.oauth_token)")
@phimage commented on GitHub (Jun 26, 2015):
If PR #78 validated