Last active
August 29, 2015 14:17
-
-
Save danshev/8a81b82636b89b1a4f65 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Oauth2 | |
class ViewController: UIViewController { | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
println("viewDidLoad") | |
let settings = ["client_id": "abcde", | |
"client_secret": "12345", | |
"authorize_uri": "https://www.linkedin.com/uas/oauth2/authorization", | |
"token_uri": "https://www.linkedin.com/uas/oauth2/accessToken", | |
"scope": "r_basicprofile", | |
"redirect_uris": ["myapp://oauth/callback"], // don't forget to register this scheme | |
] | |
let oauth = OAuth2CodeGrant(settings: settings) | |
oauth.viewTitle = "Title" // optional | |
oauth.onAuthorize = { parameters in | |
println("Did authorize with parameters: \(parameters)") | |
} | |
oauth.onFailure = { error in // `error` is nil on cancel | |
if nil != error { | |
println("Authorization went wrong: \(error!.localizedDescription)") | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment