Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I want to use Swifter.authorizeSSO(succees: _, failure: _) but the authentication page does not appear on the app. just appear Home #346

Open
dongminyoon opened this issue Apr 7, 2021 · 6 comments

Comments

@dongminyoon
Copy link

let swifter = Swifter(consumerKey: "\(APPKEY)",
                              consumerSecret: "\(SCERETKEY)")
        
if let twitterUrl = URL(string: "twitterauth://"), 
    UIApplication.shared.canOpenURL(twitterUrl) {
    swifter.authorizeSSO(success: { accToken in
        print(accToken)
    }, failure: { error in
        print(error.localizedDescription)
    })

not appear authentication page just appear Twitter Home
and appear log You should call login api before calling any im related api like thie

What can I do...?

@0xhex
Copy link

0xhex commented May 1, 2021

same issue guys,any solution?
@dongminyoon

@0xhex
Copy link

0xhex commented May 1, 2021

@meteochu

@ekurutepe
Copy link

You can still do SSO although it's deprecated if you include the url scheme twitterkit-APP_ID in your Info.plist

This is obviously a hack but still works.

@zunda-pixel
Copy link

@ekurutepe
what is APP_ID?

@ekurutepe
Copy link

@zunda-pixel Your twitter app ID

@zunda-pixel
Copy link

zunda-pixel commented Jan 6, 2022

thanks. but it doesn't work for me.

スクリーンショット 2022-01-07 0 52 09

import SwiftUI
import Swifter

struct ContentView: View {
  let consumerKey = "fake"
  let consumerSecret = "fake"
  
  func getOauthToken() {
    let swifter = Swifter(consumerKey: consumerKey, consumerSecret: consumerSecret)
    
    let swifterFailureHandler: Swifter.FailureHandler = { error in
      print(error)
    }
    
    let swifterSuccessHandler: Swifter.SSOTokenSuccessHandler = { json in
      print(json)
    }

    swifter.authorizeSSO(success: swifterSuccessHandler, failure: swifterFailureHandler)
  }
  
  var body: some View {
    Button("Login with Twitter") {
      getOauthToken()
    }
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants