Home Impossible to get email from Twitter login
Reply: 1

Impossible to get email from Twitter login

Bibin Jacob
1#
Bibin Jacob Published in 2018-02-14 07:28:45Z

I've been trying to get email from twitter login for days. Did everything according to Docs and stack overflow. Still getting the same response, This user does not have an email address.. Tried to get the email with 2 methods.

Method 1: (Here json did not contain email)

let request = TWTRAPIClient.withCurrentUser().urlRequest(withMethod: "GET", url: "https://api.twitter.com/1.1/account/verify_credentials.json", parameters: ["include_email": "true", "skip_status": "true"], error: nil)

    TWTRAPIClient.withCurrentUser().sendTwitterRequest(request, completion: { (response, data, error) in

        if let error = error {
            print(error.localizedDescription)
            return
        }
        guard let data = data else { return }
        do {
            if let json = try JSONSerialization.jsonObject(with: data, options: .mutableLeaves) as? [String: AnyObject] {
                print(json) // this json did not contain email
            }
        } catch let jsonError {
            print(jsonError)
        }
    })

Method 2: (Always gave error saying This user does not have an email address.)

TWTRAPIClient.withCurrentUser().requestEmail(forCurrentUser: { (email, error) in
    if let error = error {
        print(error.localizedDescription) // gave output "This user does not have an email address."
        return
    }
    if let email = email {
        print(email)
    }
})

Generated new keys multiple times and updated them inside App. Still getting the same error. Android App gets the email without fail using the same key that is used in iOS. Thanks in advance.

Agent Smith
2#
Agent Smith Reply to 2018-02-14 08:08:37Z

To get user email address, your application should be whitelisted.Use this form . You can either send mail to sdk-feedback@twitter.com with some details about your App like Consumer key, App Store link of an App, Link to privacy policy, Metadata, Instructions on how to log into our App etc..They will respond within 2-3 working days.

After your app is whitelisted, You can use Twitter Framework or API to get email.

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.424808 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO