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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Auth0 Hosted Login Page</title> | |
<link | |
href="https://cdn.jsdelivr.net/npm/[email protected]/dist/tailwind.min.css" | |
rel="stylesheet" | |
/> | |
<style> | |
.form-container { |
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
/** | |
@param {object} client - information about the client | |
@param {string} client.name - name of client | |
@param {string} client.id - client id | |
@param {string} client.tenant - Auth0 tenant name | |
@param {object} client.metadata - client metadata | |
@param {array|undefined} scope - array of strings representing the scope claim or undefined | |
@param {string} audience - token's audience claim | |
@param {object} context - additional authorization context | |
@param {object} context.webtask - webtask context |
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
/* * * * | |
* This is just a library of utility functions | |
* There is NO STATE maintained in `global` | |
* NOT PRODUCTION READY !! | |
* * * */ | |
function functionsLibrary(user, context, callback) { | |
const uuid = require("[email protected]"); | |
const isInteractiveAuthentication = () => { | |
const leeway = 5; // seconds |
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
const axios = require('axios'); | |
const { SecretsManagerClient, GetSecretValueCommand } = require("@aws-sdk/client-secrets-manager"); | |
let response; | |
let AUTH0_DOMAIN = process.env.AUTH0_DOMAIN; | |
let AUTH0_CLIENT_ID = process.env.AUTH0_CLIENT_ID; | |
let AUTH0_CLIENT_SECRET_ARN = process.env.AUTH0_CLIENT_SECRET_ARN; | |
let AUTH0_AUDIENCE = process.env.AUTH0_AUDIENCE; | |
let AUTH0_API2_CLIENT_ID = process.env.AUTH0_API2_CLIENT_ID; | |
let AUTH0_API2_CLIENT_SECRET_ARN = process.env.AUTH0_API2_CLIENT_SECRET_ARN; | |
let AUTH0_ACTIONS_ID = process.env.AUTH0_ACTIONS_ID; |
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
// auto linking of accounts is NOT OK in most circumstances. | |
// "user-initiated" or "prompted" account linking must be preferred. | |
// https://auth0.com/docs/users/user-account-linking#scenarios | |
function (user, context, callback) { | |
console.log(`account-link rule called ${user.user_id}`); | |
const request = require('request'); | |
// Check if email is verified, we shouldn't automatically merge accounts if this is not the case. | |
// Also, the requirement is to link a currently authenticating Enterprise (federated) Account with | |
// an existing Auth0 Database Account, so thats the only combination we are allowing. | |
if (!user.email || !user.email_verified || user.identities[0].provider === 'auth0') { |
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
user_id1 | user_id2 | user_id3 |
---|
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 getToken(cb) { | |
if (global.ACCESS_TOKEN) | |
return (cb(null, global.ACCESS_TOKEN)); | |
request.post({ | |
url: "https://tenant.auth0.com/oauth/token", | |
json: { | |
client_id: "configuration.CLIENT_ID", | |
client_secret: configuration.SECRET, | |
audience: "external API", | |
grant_type: "client_credentials" |