Skip to content

Instantly share code, notes, and snippets.

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

Shayan Memari ShayMe21

🏠
Working from home
View GitHub Profile
@ShayMe21
ShayMe21 / hlp.html
Created October 1, 2018 01:07
auth0-hosted-login-added-passwordless-option
<!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>
<button id="lock_button">Lock</button>
###--------Modules-------------------------------------------------------------#
import requests
import json
###--------Functions-----------------------------------------------------------#
clientId="nNVpnD0SxI1GI87ZvNiMOn1MOaWXw3gp"
clientSecret="--"
url="shayanmemari.au.auth0.com"
customer="testing-BFP1"
// https://auth0.github.io/auth0.net/index.html
// https://auth0.github.io/auth0.net/api/Auth0.AuthenticationApi.Models.ClientCredentialsTokenRequest.html
public async void getapi2token(){
var AuthAPI = new AuthenticationApiClient(new Uri("https://shayan-dev.au.auth0.com/"));
var api2Response = await AuthAPI.GetTokenAsync(new ClientCredentialsTokenRequest
{
ClientId = "43BKVc57RgIiVJrbM8gRDIBQgofdByYe",
ClientSecret = "xxx",
@ShayMe21
ShayMe21 / auth0js-parseHash-angular.ts
Created March 11, 2019 22:51
Auth0.js ParseHash detect state missing error check and redirect. This can happen when a user bookmarks the hosted login page or keeps the page open for 30minutes+
public handleAuthentication(): void {
this.auth0.parseHash({
}, (err, authResult) => {
if (authResult && authResult.accessToken && authResult.idToken) {
console.log(authResult);
this.localLogin(authResult);
this.auth0.client.userInfo(authResult.accessToken, function (err, user) {
localStorage.setItem("user_id", user.sub);
console.log(user.sub);
@ShayMe21
ShayMe21 / get_user.js
Created March 27, 2019 12:25
Auth0 SQL Server Custom DB Get User script
function getByEmail(email, callback) {
//this example uses the "tedious" library
//more info here: http://pekim.github.io/tedious/index.html
const sqlserver = require('tedious@1.11.0');
const Connection = sqlserver.Connection;
const Request = sqlserver.Request;
const TYPES = sqlserver.TYPES;
var user_profile = [];
@ShayMe21
ShayMe21 / auth0.service.ts
Created May 16, 2019 22:10
Auth0 Angular2+ ParseHash with error handling of rules
public handleAuthentication(): void {
this.auth0.parseHash({}, (err, authResult) => {
if (authResult && authResult.accessToken && authResult.idToken) {
this.localLogin(authResult);
this.auth0.client.userInfo(authResult.accessToken, function (err, user) {
localStorage.setItem("user_id", user.sub);
});
this.router.navigate(['/home']);
@ShayMe21
ShayMe21 / update_user_name_samlp_rule.js
Created July 12, 2019 04:45
Auth0 Update SAML IdP user's name
function (user, context, callback) {
var ManagementClient = require('auth0@2.9.1').ManagementClient;
let saml_name = `${user.first_name} ${user.last_name}`;
console.log(saml_name);
user.name = saml_name;
var management = new ManagementClient({
@ShayMe21
ShayMe21 / MyViewController.cs
Created July 31, 2018 07:27
Xamarin with Auth0 and TouchID Authentication
// https://github.com/auth0-community/auth0-xamarin-oidc-samples/tree/master/Quickstart/01-Login/iOS
using System;
using UIKit;
using Auth0.OidcClient;
using System.Text;
using LocalAuthentication;
using Foundation;
using Xamarin.Auth;
@ShayMe21
ShayMe21 / gist:a514e4030411015612e687db0e994e9b
Last active March 4, 2022 00:49
lolicode/C# OpenBullet2 - random UA selector
string[] UAs = {
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.89 Safari/537.36",
"Opera/9.80 (Windows NT 6.1; WOW64) Presto/2.12.388 Version/12.18",
"Mozilla/5.0 (X11; Linux i686; rv:78.0) Gecko/20100101 Firefox/78.0",
"Opera/9.80 (Linux armv7l) Presto/2.12.407 Version/12.51 , D50u-D1-UHD/V1.5.16-UHD (Vizio, D50u-D1, Wireless)",
"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.89 Safari/537.36",
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Firefox/78.0",
"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Firefox/78.0]"
};