Skip to content

Instantly share code, notes, and snippets.

View sandrinodimattia's full-sized avatar
🏠
Working from home

Sandrino Di Mattia sandrinodimattia

🏠
Working from home
View GitHub Profile
@sandrinodimattia
sandrinodimattia / automate-login-page-email-templates.md
Last active April 8, 2019 18:26
Automatic configuration of the Auth0 Login Page and Email Templates

Customzing the Password Reset Page

Go to the API v2 explorer and generate a token with update:tenant_settings. Then call the tenants endpoint with the new HTML:

PATCH https://{YOUR_DOMAIN}/api/v2/tenants/settings

{
  "change_password": {
    "enabled": true,
@sandrinodimattia
sandrinodimattia / advanced-hrd.html
Created May 18, 2016 07:51
Advanced HRD on the Login 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, maximum-scale=1.0, user-scalable=no" />
<style>
html, body { padding: 0; margin: 0; }
@sandrinodimattia
sandrinodimattia / hrd.html
Created May 16, 2016 03:49
Auth0 Lock - Custom HRD
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<script>
// Decode utf8 characters properly
var config = JSON.parse(decodeURIComponent(escape(window.atob('@@config@@'))));
var connection = config.connection;
var prompt = config.prompt;
var initializationOptions = {
assetsUrl: config.assetsUrl,
@sandrinodimattia
sandrinodimattia / authorization-api.md
Created May 5, 2016 09:42
Auth0 Authorization Extension API

Create a group

POST https://sandbox.it.auth0.com/api/run/YOUR_ACCCOUNT/YOUR_EXTENSION/api/groups

{
  "name": "My group",
  "description": "My group description"
}
@sandrinodimattia
sandrinodimattia / README.md
Last active February 29, 2016 16:07
Troubleshooting websocket connections in the Auth0 AD/LDAP Connector

This little script will test if you are able to connect to the AD/LDAP Connector endpoint with Websockets.

To run this:

  1. Save the file troubleshootws.js in your AD/LDAP Connector folder.
  2. Run: node troubleshootws
"use latest";
const howMany = function(cb) {
var options = {
url: 'https://auth0.com/about',
qs: {
'_escaped_fragment_': ''
},
headers: {
'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.109 Safari/537.36'
@sandrinodimattia
sandrinodimattia / auth0-whitelisting-profile-enrichment-rule.js
Last active January 18, 2016 12:28
Auth0 email domain whitelisting and profile enrichment
function (user, context, callback) {
if (!user.email_verified) {
return callback(
new UnauthorizedError('Your email address hasn\'t been verified.'));
}
var domainWhitelist = ['auth0.com', 'example.org'];
var domainMatch = _.find(domainWhitelist,
function(domain) {
var emailSplit = user.email.split('@');

Something Different... Something New... Something Familiar... Meet Joined Node

Interesting fact! Did you know the average smartphone today has more computing power than all of NASA had when people first landed on the Moon. Today, there are fewer and fewer functional areas that cannot be satisfied with the client's computing power alone and require backend computing capacity.


Here at Flybase, we are huge fans of building static websites. The power of a client-side site using Javascript is huge, and Flybase helps make that even more powerful.

I mean, just look at what you can do these days using frameworks such as Angular.js, Backbone, React, Ember or just plain vanilla Javascript and HTML. Thanks to Flybase and other tools, you can write to databases, read from databases, handle authentication, everything you need right from the client-side in real-time...

@sandrinodimattia
sandrinodimattia / impersonate.cs
Created August 17, 2015 22:36
Auth0 impersonation for SharePoint
var domain = "YOUR_DOMAIN.auth0.com";
var globalClientId = "YOUR_GLOBAL_CLIENT_ID";
var globalClientSecret = "YOUR_GLOBAL_CLIENT_SECRET";
var impersonatorId = "USER_ID_OF_THE_IMPERSONATOR";
var targetUserId = "USER_ID_OF_THE_USER_YOU_ARE_TRYING_TO_IMPERSONATE";
var targetClientId = "CLIENT_ID_OF_THE_APPLICATION_YOU_WANT_TO_LOGIN_TO";
var callbackUrl = "SHAREPOINT_URL/_trust/";
var impersonationLinkLifetime = 30; // seconds
@sandrinodimattia
sandrinodimattia / login.js
Created July 31, 2015 14:00
Auth0 - Automatically login with kerberos
/*
* Helper to get a querystring value.
*/
function getParameterByName( name ){
name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
var regexS = "[\\?&]"+name+"=([^&#]*)";
var regex = new RegExp( regexS );
var results = regex.exec( window.location.href );
if( results == null )
return "";