Cannot retrieve Twitter email if authenticating using system account on iOS

609 views Asked by At

I am using ParseUI to implement Facebook and Twitter login in my iOS app.

If a user has setup more than one Twitter system accounts then app asks account to choose when authenticating. On successful login i am retreiving user details from Twitter using call to https://api.twitter.com/1.1/account/verify_credentials.json?include_email=true

issue is in above scenario, twitter API doesn't return email address. i get email address when system account is not setup ie user logis in via web login. I do not want user to enter email address manually.

I have whitelisted the app in Twitter app setting.

i tried to below code. However, i get error :

Error - Optional(Error Domain=TWTRErrorDomain Code=3 "This user does not have an email address." UserInfo={NSLocalizedDescription=This user does not have an email address.})

let client = TWTRAPIClient.withCurrentUser()

client.requestEmail { email, error in
                 if (email != nil) {
                    print("email address is - \(String(describing: email))");
                 } else {        
                    print("Error - \(error)")
                 }
        }

is there a way to force ParseUI to do twitter authentication via browser skipping system account selection?

Thanks Ashish

1

There are 1 answers

1
Krishna Datt Shukla On

Go to Twitter app console and check mark the email permission in Additional Permissions as in the following image

enter image description here