TweetSharp - Get User Email ID after login - asp.net-mvc-3

I am using TweetSharp for user login in my asp.net mvc web app. All works fine but after login I need to save the user data in my DB as well. I cant find email from TwitterUser object after loging. How can i get user's email once the user is authenticated?
thanks

You cannot. The Twitter API doesn't return email addresses for users.
Take a look at the users/show documentation to see all the information you can retrieve.

If your app is whitelisted, you can now retrieve the email as part of verify_credentials https://dev.twitter.com/rest/reference/get/account/verify_credentials

Related

What should happen if a user sign up via social login and then tries to register with same mail?

In my Spring Boot I'd like to have both social login and signup with user and password.
Let's say the user signs-up via Google. After some time, he forgets that he signed-in via Google and tried to register using the same email.
What should happen in this case?
Should I save user info (returned by Google) in a "users" table of my database to prevent the same user to register twice?
Is there an article or something that explains a similar login/registration flow?
you can save all the users(OAuth or signup) in the user table. you can maintain a column by which you will be able to identify them if a user is signed in via OAuth or email. then if a user tries to signup via the same email you can show a message. or you can design your signup process using multiple steps. at first, the user needs to enter her email address, then you can send her an email where she needs to click some link that has some token in the url, if she previously logged in using some oath provider then she will be automatically logged in otherwise she needs to set her password.

Get email from twitter OAuth2

I am using Socialite in Laravel to login with Twitter.
I know that not all twitter users have an email attached to their account, but for my application the user does need an email address. I am fine to block logins from people who do not have an email attached, but at the moment every user does have the email field set to null.
I am using this function to redirect to twitter:
return Socialite::driver($provider)->redirect();
I have already tried using scopes like this:
return Socialite::driver($provider)->scopes(['email'])->redirect();
But twitter is the only provider that does not allow scopes.
The callback returns the email address for other providers like facebook and google, but there seems to be something that I am missing while using twitter.
For OAuth1 there was a setting somewhere to enable the option to return the email field aswell, but since twitter accepts OAuth2 I can not find this setting anymore in the Twitter developers panel.
Any help would my appreciated since most of the information about this topic is outdated.
The solution was found in the twitter developers dashboard.
First of all go to the settings of your app.
Then you have to fill in a link to your privacy policy & terms page.
After that also enable OAuth 1.0 en then an option pops up to also receive the email address from the user that is trying to log in.
Twitter's new Oauth 2.0 user authentication does not currently (at the time of writing this answer) provide access to the user's email address, and will require an additional scope to be added. This is on the Twitter API roadmap and is a known feature request.
You can still use OAuth 1.0A and set the option to request the user's email address.

How do I get the Google user ID from an email address?

I want to display the GMail avatar of the user in my app. I can easily get the image URL, using the Google People API. But this API expects a user ID.
Which other Google API can I use to pass in an email address, and get back the user ID?
The Google people api is technically hooked up to Google Contacts. So if you authenticate your user and they have added themselves with a picture you will see it that way.
The Google+ api will work the same way you authenticate the user and if they have added a picture you will be able to see it.
Which other Google API can I use to pass in an email address, and get back the user ID?
NONE. There is no way Google or any other company is going to give you an api that is going to let you search on peoples email addresses and return a picture or any information about said person you may want to consult GDRP
Email address is private user information and is only accessible by being authenticated.

How to get user email address using pinterest authentication api?

i am using pinterest api to register a user on my website. i get user id, first name, last name and url. but email is not given in the response. how can is there any api to get email of pinterest user?
You cant get email address of Authenticated user via API. Pintrest do not provide that detail through API.

Get current Google user email and logout from Google

I have an Web application that uses Google Drive. In order to make it easier for user to integrate his account (in this web application will be easier for client this way), I would like to have two links for authentication:
A link with the current user email that sends the user to the authorization page.
A link that automatically logout the current user from Google (if any) and send the user to authorization page (in this case the login page).
In order to accomplish that I need:
- the current Google user email
- logout current Google user
I really think this is not possible, but is it possible to me do this actions before have my application authorized by user?
You will only be able to pull a user's email address after they have authorized you to do so, so that isn't possible.
You can use OpenID to retrieve a user's email address or redirect them to the Google login page if they aren't logged in. They have to authorize your application, though, so you won't be able to direct them to different places until after they've signed in. There are details on the login flow at https://developers.google.com/accounts/docs/OpenID#Interaction.

Resources