Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/reneweb/oauth2orize_authorization_grant_example
This is an example of the oAuth authorization grant flow using oauth2orize, express 4 and mongoDB.
https://github.com/reneweb/oauth2orize_authorization_grant_example
expressjs javascript mongodb oauth2orize
Last synced: about 1 month ago
JSON representation
This is an example of the oAuth authorization grant flow using oauth2orize, express 4 and mongoDB.
- Host: GitHub
- URL: https://github.com/reneweb/oauth2orize_authorization_grant_example
- Owner: reneweb
- License: mit
- Created: 2014-05-17T11:59:43.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2015-04-22T13:03:43.000Z (over 9 years ago)
- Last Synced: 2023-12-12T23:37:45.435Z (about 1 year ago)
- Topics: expressjs, javascript, mongodb, oauth2orize
- Language: JavaScript
- Homepage:
- Size: 283 KB
- Stars: 24
- Watchers: 3
- Forks: 15
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
oauth2orize_authorization_grant_example
=======================================This is an example of the oAuth authorization grant flow using oauth2orize, express 4 and mongoDB.
##### Installation
```
git clone https://github.com/reneweb/oauth2orize_authorization_grant_example.git
npm install
node app.js
```
Note: You may need to change the database configuration in the db.js file, if mongoDB doesn't run using the default port or is not running on localhost.##### Usage (with cURL)
###### 0 - Register a client
Navigate to /client/registration. Register a new client.
###### 1 - Register a user
Navigate to /registration. Register a new user.
###### 2 - Get authorization token
Navigate to /oauth/authorization?clientId=<clientId>&redirectUri=<redirectUri>&responseType=code. Login with username and password. Then allow the client to access your account.
If everything works the authorization code is returned.###### 3 - Exchange the authorization code for a access token
```
curl -v -H "Content-Type: application/json" -X POST :/oauth/token -u : -d '{"code": "", "grant_type": "authorization_code"}'
```###### 4 - Access a restricted resource using the access token
```
curl -X GET :/restricted -v -H "Authorization: Bearer "
```