koa-google-jwt
0.0.1 • Public • Published koa-google-jwt
JWT-based authentication using Google OAuth for Koa
ENV
CLIENT_ID // google OAuth api id
CLIENT_SECRET // google OAuth api secret
CLIENT_URL // base url to use for callback url
Usage
const koa = require('koa')
const googleJwt = require('koa-google-jwt')
const app = koa()
app.use(googleJwt({
cookie: 'koa:jwt',
secret: '',
header: 'Authorization',
authUrl: '/auth/google',
callbackUrl: '/auth/google/callback',
requireAuth: true
}))
router.get('/protected', ctx => {
ctx.body = `Welcome ${ctx.state.user.name}!`
})
ctx.state.user
ctx.isAuthenticated()
ctx.logout()
Readme
Keywords
nonePackage Sidebar
Install
Weekly Downloads