Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- override func viewDidAppear(_ animated: Bool) {
- let keychain = Keychain(service: "kfurue.RxSwiftRailsTutorial-token")
- if keychain["oauthToken"] == nil {
- oauthswift.authorizeURLHandler = SafariURLHandler(viewController: self, oauthSwift: oauthswift)
- oauthswift.authorize(
- withCallbackURL: URL(string: "sample-app://oauth-callback")!,
- scope: "", state: "hoge",
- success: { credential, _, _ in
- print(credential.oauthToken)
- // OAuthSwiftで取得したトークンをKeychainにストアする
- keychain["oauthToken"] = credential.oauthToken
- },
- failure: { error in
- print(error.localizedDescription)
- }
- )
- }
- }
Add Comment
Please, Sign In to add comment