Skip to content

Instantly share code, notes, and snippets.

View saltukalakus's full-sized avatar
💭

Saltuk Alakus saltukalakus

💭
View GitHub Profile
@saltukalakus
saltukalakus / index.html
Last active July 14, 2022 18:35
Custom Classic Universal Login Page with Email validation.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Sign In with Auth0</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://unpkg.com/validator@latest/validator.min.js"></script>
</head>
@saltukalakus
saltukalakus / delete_facebook_users_without_email.js
Created December 4, 2018 20:06
Prevent Facebook users who doesn't give consent for email with an Auth0 rule.
function ( user, context, callback ) {
// Only execute for Facebook Logins
if ( context.connectionStrategy !== 'facebook' )
return callback( null, user, context );
// If User hasn't granted email permissions
if ( typeof user.email === 'undefined' ) {
// Load auth0 Management SDK
@saltukalakus
saltukalakus / update_client.md
Created April 19, 2022 15:42
Custom classic login page per application
PATCH Auth0-domain/api/v2/clients/[client-id]
{
    "custom_login_page": "<!DOCTYPE\nhtml> <html> <head> \n<meta\ncharset=\"utf-8\"> \n<meta\nhttp-equiv=\"X-UA-Compatible\"\ncontent=\"IE=edge,chrome=1\"> \n<title>Sign\nIn\nwith\nAuth0</title> \n<meta\nname=\"viewport\"\ncontent=\"width=device-width,\ninitial-scale=1.0\"\n/> \n<link\nrel=\"stylesheet\"\nhref=\"https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css\"> </head> \n<style> \nbody,\nhtml\n{ \nheight:\n100%; \nbackground-color:\n#f9f9f9; \n} \n.login-container\n{ \nposition:\nrelative; \nheight:\n100%; \n} \n.login-box\n{ \nposition:\nabsolute; \ntop:\n50%; \ntransform:\ntranslateY(-50%); \npadding:\n15px; \nbackground-color:\n#fff; \nbox-shadow:\n0px\n5px\n5px\n#ccc; \nborder-radius:\n5px; \nborder-top:\n1px\nsolid\n#e9e9e9; \n} \n.login-header\n{ \ntext-align:\ncenter; \n} \n.login-header\nimg\n{ \nwidth:\n75px; \n} \n#error-message\n{ \ndisplay:\nnone; \nwhite-space:\nbreak-spaces; \n} \n</style> <body> \n<div\nclass=\"login-co
@saltukalakus
saltukalakus / .env
Last active April 3, 2022 09:08
A sample showing how to use role claim with Auth0 using express-openid-connect library
# conf
PORT=3000
ISSUER_BASE_URL=https://your-account.[region].auth0.com
CLIENT_ID=your-client-id
CLIENT_SECRET=your-client-secret
BASE_URL=http://localhost:3000
SECRET=LONG_RANDOM_VALUE
@saltukalakus
saltukalakus / RefreshTokenStepUpRule.js
Last active January 5, 2022 19:14
Step up authentication with refresh tokens.
function (user, context, callback) {
// Only applied for the refresh token flow along with the special scope (e.g.: transfer:funds) that
// will trigger the MFA step up.
if (context.protocol === "oauth2-refresh-token" &&
context.request.body &&
context.request.body.scope &&
context.request.body.scope.indexOf('transfer:funds') > -1) {
// Insert a custom claim in id token which would be checked along with amr claim
module.exports = function (raw_data) {
var profile = {
id: raw_data.objectGUID || raw_data.uid || raw_data.cn,
displayName: raw_data.displayName,
name: {
familyName: raw_data.sn,
givenName: raw_data.givenName
},
nickname: raw_data['sAMAccountName'] || raw_data['cn'] || raw_data['commonName'],
groups: raw_data['groups'],
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Sign In with Auth0</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
</head>
<style>
@saltukalakus
saltukalakus / PasswordlessLock.html
Last active July 26, 2021 07:56
A workaround to configure Passwordless Lock with an enterprise connection.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Sign In with Auth0</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
</head>
<body>
@saltukalakus
saltukalakus / Sample_user_profile.json
Last active June 5, 2021 08:11
Auth0 SAML IdP mapping attributes from within arrays
{
"id": "118028435727952686478",
"primaryEmail": "john@dough.com",
"name": "John Dough",
"isAdmin": false,
"isDelegatedAdmin": false,
"lastLoginTime": "2021-01-05T13:27:25.000Z",
"creationTime": "2016-10-03T15:55:40.000Z",
"addresses": [
{
@saltukalakus
saltukalakus / classic-hosted-page.html
Last active March 29, 2021 10:25
The passwordless and regular login with lock on the same universal page.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Sign In with Auth0</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
</head>
<style>