How to authenticate that user owns twitter account? - twitter

I'm developing a social network. Users may register and share their twitter username (if they want). Wherever the user posts a comment or other content, his username is displayed. I would like to display the follow #userTwitter button, if the user has set the twitter account.
Now, everything works, the problem is to validate that the user is the owner of that twitter account. Right now the user could be entering any valid twitter account! Maybe using the Twitter api?

You can set your app up as a Twitter client, this way your user has to log into twitter to authorize your app, thereby verifying their twitter identity.
This is a couple years old but might be enough to get you started:
http://www.1stwebdesigner.com/tutorials/twitter-app-oauth-php/

Related

Allow private/protected Twitter profiles to be seen via Application tokens

So I'm building an app which allows to link a twitter user during registration. Now a problem which has been seen is that some twitter users have their profiles set to private and no post can be shown.
This is not a good thing as an admin should directly go to a twitter profile to manually (for now) check if a twitter profile is fake or not.
Now my question: is there a part of the twitter API where you can use tokens to generate a url which will be used to show tweets only for users which authenticated with my app?
No, there is no way to do this. A protected user must choose to allow another user to follow them in order for the Tweets to be seen. This is not part of the Twitter API.

How does social oauth really works?

I am confused with how social oauth works? Lets say i have implemented social oauth login in my project.
user A signed up in my website with Google Oauth. I somehow put that SIGN UP WITH GOOGLE button in my sign up page and then user will click it and will be directed to a link where google will ask to authorize my app or not. If the user A allows, then at first time what information does the google server send to my server. It will send something so that i could save it in my server to know that a user A has been signed up and could give the userA a id to link it to other tables of my database which is in my server (nothing to do with google server). So real question is what will google(or any other service provider like facebook, twitter etc) send me when a new user signed up and when a existing user signed in again. what will happen if a user (already signed up) try to sign up again? or didn't authorize the website again when logging in?
If you want more detailed question, please comment and I will elaborate.
Ok first off lets use a different term than social login. Lets call it third party login and heres why.
Your application has its own login system users can create their accounts on your system by say adding an email address and creating a login name and a password. Now you want to add third party login that being, Facebook, google and twitter login. These are actually third party logins.
What you will actually be doing is linking the users third party social media accounts with your login system. The term often used for this is called account linking.
Lets say user A has created an account in your system already now A has a Facebook account so they would like to link their Facebook account with your login system. So you create a Facebook login button Facebook will return to you an id this often being the id of the user on facebooks system. So when the user logs in using Facebook you get the Facebook id back that you can store on the users account in your system.
Things get a little more confusing if user B wants to login to your system using Google and B does not already have an account in your system
when they login then you will probably get the users id and i think you get their email address back as well so you can use the email address from google so you can create them a actual account on your system and directly link the google login to it automatically.
Its been a while since i have done it but i believe that you get the user id and the email returned to you from third party providers you may want to check thought if memory serves they are not all the same and you may have to make a request to get the email address after you get the id back.
Social login is still not normalized. You have to work them out one by one unless you leverage something that do it for you like the trusstee.io solution.
It appears to be simple to use and is described here https://medium.com/me/stats/post/ef5d5a5a3943.

Providing safety in omniauth authorization with existing email

Ok, let's imagine I've got my Rails application and user creates account through the app with email xxx#example.com.(He doesnt have any social account). My app has included Twitter,Google+ Facebook sign up with Omniauth gem. So now, let's say, that there is a malicious hacker, which creates social account on Twitter, G+ or Facebook with email xxx#example.com. He goes to our app, he can't log in normal way, but he can easly get into account by his social account, which matches with user email xxx#example.com. So, the question is, how we can provide safety in this situation? Or is it provided mayby in the way I dont get?
If i understand your question correctly, none of the social media accounts can be created without confirming your email id. So there is no way someone is going to create account in Twitter, G+ or Facebook with your email id.

In IOS 5 how do we login to twitter from our application?

All the tutorial I found explains how to tweet and show an alert message if users cannot tweet.
What about if user hasn't logged in to twitter yet and I want to help user logged in to tweeter.
Basically we want to allow user to sign up to our services via facebook and twitter. We've taken care of facebook. Now we need to so it for twitter.
This are samples of tutorial I found
http://www.raywenderlich.com/5519/beginning-twitter-in-ios-5
I don't want to tweet. I just want to login first so I can store the users' twitter id on my database allowing it to save bookmarks, etc..
All I see is https://dev.twitter.com/docs/ios. It's not clear whether we have to compute the sig manually, do we have to open safari or what.
Did you go through api documentation on twitter integration to ios?
Here is a similar question.May be this will help you
If you want your users to login with their twitter accounts, you will have to register your application with Twitter to obtain a key to sign your requests. You can read more about this on Twitter Developer Page

multiple oauth providers and implicit user account creation

I'm learning oauth 2.0 and was wondering about the following scenario
say I want a website to allow login with both twitter and facebook
when a new user logs in for the first time using twitter, the server checks if a user with this twitter id exists in the database and if not, creates a new user using values returned from twitter
the same user logs out and logs in again, this time using his facebook account
Question: how can I match the returning user with the account that was created the first time and avoid creating a second user account for the same user ?
Thanks
If you request for their email address, you can detect matches and merge that way?
If you are only interested in having the user log in, then you should be looking at openID, not OAuth.
Unless you explicitly ask the user to link their various accounts together for your app, there really isn't a good way to know that JohnDoe on Twitter is JohnDoe on Facebook.
You can ask the customer to link their accounts together and give them tools to merge two accounts (one created with Twitter account and one with Facebook account) together.

Resources