Skip to content

Instantly share code, notes, and snippets.

View pravinady's full-sized avatar

Praveen Addepally pravinady

  • Auth0
  • Minneapolis, MN
View GitHub Profile
@pravinady
pravinady / add-custom-sessionID.js
Last active September 26, 2023 15:43
add-custom-sessionID
/**
* 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";
@pravinady
pravinady / detect-login
Last active April 6, 2020 23:28
detect-login
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);