Manually open a TWTRSession


I see I can create a TWTRSession by using initWithSessionDictionary: but how can I use it. And I don’t see any method in Twitter class that allow me to set a custom session.
How can I use a custom session with TwitterKit?



Currently, a TWTRSession is created and returned to the developer after successful login. This session is then used to make Twitter API requests.


So If I already have a token, I can’t use it and user must login again. It makes no sense.



Thanks for reaching out and letting us know about your use case. This functionality is available on android but not iOS yet.


Hey, any update on this? Can we create a session manually on iOS, if we have an auth token?


Hi ankkur_arya,

We’ve made some progress on this but it’s not ready yet. For what it’s worth, tokens are automatically persisted so your users won’t have to re-login after the first time. Are you essentially trying to do a singe sign-on if a user has logged in to your web app?


Hey Kang,

Thanks for the response. What I am trying to do is if user has once connected to my app using Twitter he doesn’t need to connect again even if he has deleted the app from iPhone and later reinstalled it.
I am not sure if I should do this (or it is correct to do this) but this is essential for my app. I have seen an app ([HootSuite][1]) that is doing the same and I am not sure how they are doing it (my guess is they are making the call from server side).

I’ll be really glad if you could shed some light on this.


When a user logs in on iOS, we automatically persist their tokens to system accounts. All your users have to do if they uninstall then reinstall the app is agree to grant your app access to the system accounts but they wouldn’t have to enter their credentials again. Was this what you were looking for?


I was thinking of the same thing, App —> App Server —> Twitter. If a user authorizes/authenticates my App to access his/her Twitter account on device A (iOS) and later signs in on device B (iOS) using my app’s credentials, I’d like device B to be allowed that same access. Like @shizzleapp said, there doesn’t seem to be a way to use a custom session with TwitterKit.


Hi Peter,

Yea unfortunately not right now. I will discuss this with the team. Thanks for explaining your use case!

closed #11