Skip to content

Instantly share code, notes, and snippets.

@claustres
Created June 22, 2022 08:04
Show Gist options
  • Save claustres/2d4319f970b7f520c9258ec000f53eb5 to your computer and use it in GitHub Desktop.
Save claustres/2d4319f970b7f520c9258ec000f53eb5 to your computer and use it in GitHub Desktop.
OAuth configuration file for Feathers v4
module.exports = {
authentication: {
secret: 'your secret',
path: '/authentication',
service: '/users',
entity: 'user',
authStrategies: [
'jwt',
'local'
],
local: {
usernameField: 'email',
passwordField: 'password'
},
jwtOptions: {
header: {
typ: 'access' // See https://tools.ietf.org/html/rfc7519#section-5.1
},
audience: 'your domain', // The resource server where the token is processed
issuer: 'your company', // The issuing server, application or resource
algorithm: 'HS256', // See https://github.com/auth0/node-jsonwebtoken#jwtsignpayload-secretorprivatekey-options-callback
expiresIn: '1d'
},
oauth: {
redirect: 'your domain',
keycloak: {
key: 'client id',
secret: 'client secret',
oauth: 2,
scope: ['openid'],
authorize_url: '{your keycloak domain}/auth/realms/{your realm}/protocol/openid-connect/auth',
access_url: '{your keycloak domain}/auth/realms/{your realm}/protocol/openid-connect/token',
profile_url: '{your keycloak domain}/auth/realms/{your realm}/protocol/openid-connect/userinfo',
nonce: true
} ,
github: {
key: 'client id',
secret: 'client secret',
scope: ['openid'],
nonce: true
},
google: {
key: 'client id',
secret: 'client secret',
scope: ['openid', 'email', 'profile'],
nonce: true
},
cognito: {
key: 'client id',
secret: 'client secret',
oauth: 2,
scope: ['openid'],
authorize_url: 'https://{your cognito domain}.amazoncognito.com/oauth2/authorize',
access_url: 'https://{your cognito domain}.amazoncognito.com/oauth2/token',
profile_url: 'https://{your cognito domain}.amazoncognito.com/oauth2/userInfo',
nonce: true
}
}
}
// Remaining configuration
// ...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment