1.14.0 • Published 4 years ago
userin-core v1.14.0
userin-core ·
UserIn core component to build an OAuth 2.0 OpenID Connect web API that supports integration with the most popular Federated Identity Providers (e.g., Google, Facebook, GitHub)
npm i userin-core
Table of contents
Create a new UserIn Strategy
const { Strategy } = require('userin-core')
class CustomStrategy extends Strategy {
constructor() {
super()
this.name = 'yourcustomstrategy'
this.generate_token = (root, { type, claims }) => { /* Implement your logic here */ }
this.get_client = (root, { client_id, client_secret }) => { /* Implement your logic here */ }
this.get_end_user = (root, { user }) => { /* Implement your logic here */ }
this.get_fip_user = (root, { strategy, user }) => { /* Implement your logic here */ }
this.get_identity_claims = (root, { user_id, scopes }) => { /* Implement your logic here */ }
this.get_token_claims = (root, { type, token }) => { /* Implement your logic here */ }
}
}
To facilitate custom implementation, we've added a template here.
Utilities
token.id_token.addDateClaims(claims: Object[, expiryInSeconds: Number])
expiryInSeconds
is optional. Its default value is 3600
seconds.
const { token } = require('userin-core')
const claims = { iss:'https://example.com', first_name:'Nic', last_name:'Dao' }
console.log(token.id_token.addDateClaims(claims, 3600))
// Prints:
// {
// iss:'https://example.com',
// first_name:'Nic',
// last_name:'Dao',
// iat: 1600148277,
// exp: 1600151877
// }
1.14.0
4 years ago
1.13.0
4 years ago
1.12.1
4 years ago
1.12.0
4 years ago
1.11.0
4 years ago
1.10.0
4 years ago
1.9.3
4 years ago
1.9.2
4 years ago
1.9.1
4 years ago
1.9.0
4 years ago
1.8.0
4 years ago
1.7.0
4 years ago
1.6.2
4 years ago
1.6.1
4 years ago
1.6.0
4 years ago
1.5.1
4 years ago
1.5.0
4 years ago
1.4.0
4 years ago
1.3.2
4 years ago
1.3.1
4 years ago
1.3.0
4 years ago
1.2.3
4 years ago
1.2.2
4 years ago
1.2.1
4 years ago
1.2.0
4 years ago
1.1.0
4 years ago
1.0.3
4 years ago
1.0.2
4 years ago
1.0.1
4 years ago