how to login in swift

132 views
Skip to first unread message

Deniz Yildirim

unread,
Dec 3, 2016, 7:24:07 PM12/3/16
to Tumblr API Discussion
Hi,
I am trying to develop 3th party tumblr app. I didnt figure out for check user's email and password for signing in. I have consumer key and Secret Key.... I am trying to do this with OAuthSwift and TMTumblrSDK.

Can u show me with an example how to I check users credential's. 

Ian Ynda-Hummel

unread,
Dec 3, 2016, 7:29:56 PM12/3/16
to Tumblr API Discussion
Hey Deniz,

Take a look at the start of `authenitcateNewAccount` in https://github.com/ianyh/Highball/blob/master/Highball/AccountsService.swift. There's some stuff specific to my app, but the set up is basically universal. I'm not at a laptop, so formatting might be wrong, but here is the copied code:

let oauth = OAuth1Swift(
consumerKey: TMAPIClient.sharedInstance().OAuthConsumerKey,
consumerSecret: TMAPIClient.sharedInstance().OAuthConsumerSecret,
requestTokenUrl: "https://www.tumblr.com/oauth/request_token",
authorizeUrl: "https://www.tumblr.com/oauth/authorize",
accessTokenUrl: "https://www.tumblr.com/oauth/access_token"
)
let currentAccount: Account? = account

account = nil

TMAPIClient.sharedInstance().OAuthToken = nil
TMAPIClient.sharedInstance().OAuthTokenSecret = nil

oauth.authorize_url_handler = SafariURLHandler(viewController: viewController)

oauth.authorizeWithCallbackURL(
NSURL(string: "highball://oauth-callback")!,
success: { (credential, response, parameters) in
TMAPIClient.sharedInstance().OAuthToken = credential.oauth_token
TMAPIClient.sharedInstance().OAuthTokenSecret = credential.oauth_token_secret


With "highball://" replaced with your application's URL handler as per the OAuthSwift docs.
--
You received this message because you are subscribed to the Google Groups "Tumblr API Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tumblr-api+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages