Twitter Kit login via iOS Twitter app

ios
login

#1

Hello!
Im trying login using Twitter Kit via my iOS app. As doc says “Twitter Kit first attempts to authorize users via the Twitter for iOS app, if installed.” but when I call :loginWithCompletion method I always login via WebView, not via my installed Twitter app.
Also I’ve added twitter and twitterauth to my info.plist file for key LSApplicationQueriesSchemes.
Why I can login using native Twitter app if its installed (not webView)


#2

Hey @a_d3vn! are you handling the login redirect documented here?


#3

Hey, thanks for answer!
Yes, exactly by this doc


#4

Do you have a callback url set for your application in https://apps.twitter.com?


#5

What value I have to provide in callback URL?
Now I have “twitter://”


#6

As per the TwitterKit docs:

To create a new Twitter app or use existing Twitter app, visit Twitter apps dashboard and copy the keys from the “Keys and Access Tokens” tab of your app page.

To add call back URL:

In Twitter apps dashboard, find your application and go to the permissions tab.
Select the appropriate permissions for your needs (e.g. “Read and write”)
If you are using login, add a placeholder URL in the Callback URL field (eg. “http://placeholder.com”).
Click update settings.

You can just use http://placeholder.com and that should work fine for redirecting to the Twitter App


#7

Thank you for your answer!
Unfortunately http://placeholder.com in callback URL field didn’t solve the
issue.
Login still happens through WebView.
Anything else?
Thank you!


#8

Are you also overriding the openURL method in your app delegate?


#9

Yes, of course


#10

HI @a_d3vn, in our code, we check whether CFBundleURLTypes and CFBundleURLSchemes has expected Twitter Kit URL scheme. If not, then we move onto web flow. Is the plist set as installation?


#11

Yes, this is my plist