Home Impossible to get email from Twitter login
Reply: 0

Impossible to get email from Twitter login

user1719
1#
user1719 Published in August 16, 2018, 6:16 am

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.

You need to login account before you can post.

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

© 2016 Powered by mzan.com design MATCHINFO