Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Linking several oauth accounts to a single user: what's considered safe practice and what's not?

In my web app, users are authorized either through Twitter or Facebook. I intend to also allow them, while logged in with, say, Twitter, to login with Facebook.

Even at this point, could a user's account be compromised? I thought about it and couldn't find any pitfalls, but maybe I just haven't looked hard enough.

Moreover, I intend to store both oauth tokens in a single row in a database, so that when the user logs in with Facebook, s/he's automatically being logged in with Twitter, too (to, e.g., be able to post to both places if s/he chooses so). (I haven't yet implemented this, so I won't be surprised if it's impossible ;)

Is this considered safe practice? I couldn't find any potential gotchas, so I need advice from more experienced people.

like image 599
Unknown artist Avatar asked Aug 15 '11 14:08

Unknown artist


People also ask

Which of the following is preferred way to authenticate a user when using OAuth 2 protocol?

A standard for user authentication using OAuth: OpenID Connect. OpenID Connect is an open standard published in early 2014 that defines an interoperable way to use OAuth 2.0 to perform user authentication.

Why OAuth should not be used for authentication?

Let's start with the biggest reason why OAuth isn't authentication: access tokens are not intended for the client application. When an authorization server issues an access token, the intended audience is the protected resource. After all, this is what the token is providing access to.

What is OAuth vulnerability?

Perhaps the most infamous OAuth-based vulnerability is when the configuration of the OAuth service itself enables attackers to steal authorization codes or access tokens associated with other users' accounts. By stealing a valid code or token, the attacker may be able to access the victim's data.


1 Answers

As long as you keep your access tokens unavailable, storing two of them is not less secure than storing one of them.

As mentioned above, having them on the same row in a table is probably not optimal if you want to integrate more services in the future, but when that happens it surely not hard to refactor your code to satisfy that need.

like image 88
Jon Nylander Avatar answered Oct 04 '22 05:10

Jon Nylander