How to read email address of logged in user in Fabric Twitter-Core


#1

I am using Twitter Fabric for user login in my application. When the user login using my app I need email if of the logged in user. How can I retrieve the email address of logged in user.


#2

Hi James,

Requesting a user’s email address requires your application to be whitelisted by Twitter.

Please take a look at Request a User’s Email Address for Twitter Kit on iOS and Twitter Kit on Android to request access and then how to retrieve the email address in your app once the user grants access.

Let us know if you have any other questions!

Best,
Romain


#3

@romainhuet Can we customized the TwitterSignInButton. I m just asking because Facebook, google allows it. I just want to show twitter Image instead of text


#4

I just started using Fabric and I am running into trouble getting email. My app says it is authorized for read, write, and direct messages. I can log in without issue, the request email view is displayed (iOS), but when I click allow, the email is always nil with the message: Code=37 "Your application may not have access to email addresses or the user may not have an email address. To request access, please visit https://support.twitter.com/forms/platform." UserInfo=0x7f7ff29a6090

The code is pretty simple:

    TWTRLogInButton *logInButton = [TWTRLogInButton buttonWithLogInCompletion:^(TWTRSession *session, NSError *error) {
    // play with Twitter session
    TWTRShareEmailViewController *shareEmailVC = [[TWTRShareEmailViewController alloc] initWithCompletion:^(NSString *email, NSError *error) {
        NSLog(@"Email %@, Error: %@", email, error);
        CLUserDetailsViewController *udVC = [[CLUserDetailsViewController alloc] initWithEmail:email];
        [self.navigationController pushViewController:udVC animated:YES];
    }];
    [self presentViewController:shareEmailVC animated:YES completion:nil];
}];

Any help is appreciated.


#5

Hi @romainhuet, I’ve integrated a twitter login for my iOS app using Fabric.

I’d like to request the users email (https://dev.twitter.com/twitter-kit/ios/request-email) and this page sends me here to request it -> https://support.twitter.com/forms/platform.

Am I meant to be requesting xAuth?

If so do I use my Frabic app credentials (Consumer Key etc) OR am I meant to be creating a new app in twitter (https://apps.twitter.com) and using these details?

I ask because the form asks for an Application ID but there’s no evidence of this in Fabric. Likewise it seems weird to create a new app in twitter (https://apps.twitter.com) because I’ll somehow have to link this to what I have in my iOS app already?

Any help would be really appreciated!

Thanks,
Phil


#6

At the moment, unfortunately our Platform Support forms on that page do not have a really good option for requesting email for Fabric. I’d recommend using the “xAuth” option for now, but make it clear that you want email address in Fabric and NOT xAuth in the response.

You do still need to provide a Consumer Key, which you will be able to find on your fabric.io dashboard. You’ll find that under the Twitter tab on the left sidebar.