1.0.40 • Published 8 years ago
hapi-wso2-apim
Licence
BSD-3-Clause
Version
1.0.40
Deps
8
Size
15 kB
Vulns
4
Weekly
0
hapi-oauth2-access-token
This is a plugin for Hapijs server used to integrate OAuth2 Server.
Usage
- Run the command
npm install hapi-oauth2-access-tokenuse the flag--saveto add yourpackage.jsonfile. - Register plugin
var HapiOAuth2AccessToken = require('hapi-oauth2-access-token')
server.register({
register: HapiOAuth2AccessToken,
options: {
host: 'your-host',
clientId: 'your-client-id',
clientSecret: 'your-client-secret',
protocol: 'http' // optional, default is http
}
}- Set auth to your routes:
server.route({
method: 'GET',
path: '/',
config: {
auth: 'bearer',
handler: (request, reply) => {
reply('private resource')
}
}
})- Enjoy the magic
Create with by Yalo