oauth2orize-example
oauth2orize-example copied to clipboard
Oauth2 server example
OAuth2orize app example
This app is an example to demonstrate how to make a simple oauth2 server provider with OAuth2orize.
Installing (unix like way)
$ mkdir ~/projects
$ cd ~/projects
$ git clone [email protected]:joaoneto/oauth2orize-example.git
$ cd oauth2orize-example
$ npm install
DB setup
Create a user:
» use oauth2orize
» db.users.insert({name: "Foo Bar", "email": "[email protected]", password: "123"})
» db.users.find()
{ "_id" : ObjectId("XXXXXXXXXXXXXXXXXXXXXXXX"), "name" : "Foo Bar", "email" : "[email protected]", "password" : "123" }
Create a client:
» db.clients.insert({user_id: ObjectId("XXXXXXXXXXXXXXXXXXXXXXXX"), secret:"abc123", redirect_uri:"http://localhost:3000"})
Edit client_oauth.sh (gist)
Change CLIENT_ID="XXXXXXXXXXXXXXXXXXXXXXXX", replace X with your client_id.
Init app
$ node server
Test
$ ./client_oauth.sh