WP-API / OAuth1

OAuth server implementation for WP API
http://oauth1.wp-api.org/
334 stars 112 forks source link

How to limit concurrent logins in OAuth1? #121

Open natanaelsinisalo opened 8 years ago

natanaelsinisalo commented 8 years ago

I'm relatively new with the OAuth so i'm still trying to grasp the whole picture of the auth process. I've implemented this plugin to my site and built a client successfully.

Let me brief at first what i'm trying to do:

Everything's good so far. Now, we'd like to restrict concurrent logins to 2 per user id. I've been thinking something like this:

So my few questions are:

I'm capable of making a pull request if there's a good way to implement this.

Cheers!

natanaelsinisalo commented 8 years ago

I might have found an answer:

Since this plugin currently saves an option row for each authorisation which contains oauth_token and user id along with the incrementing id, it's quite easy to wrote a clean cron job which keeps two newest sessions per user and cleans the rest.

Is there any possible downsides about this implementation?