This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Handler that will be called during the execution of a PostLogin flow. | |
* Generates a custom sessionID & adds it to the accessToken & idToken | |
* | |
* @param {Event} event - Details about the user and the context in which they are logging in. | |
* @param {PostLoginAPI} api - Interface whose methods can be used to change the behavior of the login. | |
*/ | |
const { v4: uuidv4 } = require('uuid'); | |
const SESSIONID_CLAIM_NAME = 'x-session-id'; | |
const PROTOCOL_PASSWORD_GRANT = "oauth2-password"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function (user, context, callback) { | |
//Check if authn method match pwd or social connections | |
const authMethod = context.authentication.methods.find( | |
(method) => { | |
return (method.name === 'pwd' || method.name === 'federated'); | |
} | |
); | |
console.log('auth method is:', authMethod); | |