3

I am developing an app using node.js which will also have an mobile client. I am looking to make the authentication using OAuth 2.0. Is there any good module which allows me to have OAuth 2.0 authentication server?

I looked at a subsidiary module of Passport "OAuth2orize". I found it quite good enough, but the real problem was understanding how it will work for my own app (the example and docs specify about third party authorisation).

Basically what I want is that the client logs in with client id, user's username, user's password and there by I hand him a token after verifying the above 3 things. But the problem with Oauth2orize is that there there are redirect URI and all which is confusing me a lot.

Please help me know as to how can i achieve this using Oauth2rize or any other really good module. Or If its easy enough I can also roll my own, but will that be a good idea regarding security ??

Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343
Saransh Mohapatra
  • 9,430
  • 10
  • 39
  • 50
  • Same problem here, I do not quite get the internal stuff of oauth2orize and do not manage to integrate it in my app (http://stackoverflow.com/questions/23005627/securing-a-nodejs-sailsjs-api-with-oauth2). Any update so far ? – Luc Apr 16 '14 at 14:03

1 Answers1

0

What you are looking for is the Resource Owner Password Credentials flow. As you've seen, the examples for oauth2 do not include functionality that supports this flow. In fact the examples only cover the Authorization Code flow.

It should end up being fairly easy to implement. All you need to do is accept a request that contains the information you are looking for (and authorize it) and create a token in your token database and return it. As long as you use the same token database that the rest of oauth2orize is using, it should work just fine. See: Passing Trusted Client Information with oAuth2orize for the "Resource Owner Password Flow" where that is exactly what is suggested.

Correction: The all-grants example of oauth2orize supports the Implicit flow as well as Authorization Code flow.

Community
  • 1
  • 1
davidpricedev
  • 2,107
  • 2
  • 20
  • 34