It looks like the example code you linked to is very old (SDK 14!) and won’t work any more. We’ll try to update this when we get a chance, thank you for bringing that to our attention.
For now, you can use more recent Expo Apis and follow the same general idea as that example code–
There is a pull request in that example that solved my problem.
In addition to this, I was instructed by twitter support team to type only the scheme (which is exp://) in the callback url field in the twitter app settings instead of the entire callback url to my app and everything should work perfectly.