Skip to content

Instantly share code, notes, and snippets.

Josh Cunningham joshcanhelp

Block or report user

Report or block joshcanhelp

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@joshcanhelp
joshcanhelp / SetAccessTokenCookie.php
Last active Feb 6, 2019
Auth callback middleware to set an access token in Laravel
View SetAccessTokenCookie.php
<?php
// app/Http/Middleware/SetAccessTokenCookie.php
namespace App\Http\Middleware;
use Closure;
class SetAccessTokenCookie
{
/**
@joshcanhelp
joshcanhelp / laravel-auth0.php
Last active Jan 29, 2019
Laravel config settings for Auth0 API authentication
View laravel-auth0.php
<?php
// config/laravel-auth0.php
return [
// ...
// Your Auth0 domain as a URL with a trailing slash.
'authorized_issuers' => [ 'https://your-tenant.auth0.com/' ],
// The "Identifier" field for the API you created in Auth0.
'api_identifier' => 'https://quickstarts/api',
// This is the same as the API algorithm.
'supported_algs' => [ 'RS256' ],
@joshcanhelp
joshcanhelp / CheckJWT.php
Last active Jan 29, 2019
Laravel middleware for access token verification on an API
View CheckJWT.php
<?php
// app/Http/Middleware/CheckJWT.php
namespace App\Http\Middleware;
use Closure;
use Auth0\SDK\JWTVerifier;
class CheckJWT {
public function handle($request, Closure $next) {
@joshcanhelp
joshcanhelp / sdk_quality_scripts.js
Last active Feb 16, 2019
Google Script Editor functions for getting SDK quality metrics
View sdk_quality_scripts.js
/* globals SpreadsheetApp, Browser, CacheService, UrlFetchApp, PropertiesService */
/*
*
* Macro functions
*
*/
/**
* Prompt the user for a GitHub API token.
View Sample DB login script
function login (email, password, callback) {
console.log(email);
var request = require("request");
request.post(
"[APP_ENDPOINT_HERE]",
{
form: {
@joshcanhelp
joshcanhelp / get_connection.json
Created Oct 10, 2018
Sample get connection response
View get_connection.json
{
"id": "[REDACTED]",
"options": {
"mfa": {
"active": true,
"return_enroll_settings": true
},
"passwordPolicy": "[REDACTED]",
"enabledDatabaseCustomization": true,
"requires_username": true,
@joshcanhelp
joshcanhelp / lock-options-with-state.js
Created Jun 26, 2018
How the Lock options object should look in View Source
View lock-options-with-state.js
var wpAuth0LockGlobal = {"settings":{"auth":{"params":{"state":"STATE_VALUE_FROM_AUTH0_STATE_COOKIE","scope":"openid email profile"},"responseType":"code","redirectUrl":"http:\/\/wp.localhost.test\/wp\/index.php?auth0=1","sso":true},"passwordlessMethod":"link","socialButtonStyle":"small","container":"auth0-login-form"},"ready":"1","domain":"joshc-test.auth0.com","clientId":"YOUR_CLIENT_ID","stateCookieName":"auth0_state","nonceCookieName":"auth0_nonce","usePasswordless":"","loginFormId":"auth0-login-form","showAsModal":"","i18n":{"notReadyText":"Auth0 is not configured","cannotFindNodeText":"Auth0 cannot find node with id ","modalButtonText":"Login"}};
@joshcanhelp
joshcanhelp / copy-tags-to-wp-svn.sh
Last active Jun 6, 2018
Copy git repo tags to an svn directory
View copy-tags-to-wp-svn.sh
#!/bin/sh
# Change "grep ^3." to filter by a different major (or remove)
# Change "~/Sites/wp-svn" to the correct path to your local svn repo
# Change rsync excludes, if needed
# Run this in a git repo with tags
for f in $(git tag -l | grep ^3.); do git checkout tags/"$f"; rsync -rv --exclude .git --exclude vendor ./ ~/Sites/wp-svn/tags/"$f"; done
@joshcanhelp
joshcanhelp / generate-wp.sh
Last active Jul 2, 2018
Generate a WP instance locally - WIP
View generate-wp.sh
#!/bin/sh
# #########
# Variables
# #########
WORKING_DIR="/Users/josh-cunningham/Sites/wordpress-test-fixture"
DB_NAME="wordpress_test_fixture"
DB_USER="root"
DB_HOST="localhost"
@joshcanhelp
joshcanhelp / wp_auth0_default_settings.json
Created May 7, 2018
Default WP-Auth0 settings for reset
View wp_auth0_default_settings.json
{
"version":1,
"last_step":1,
"migration_token_id":null,
"use_lock_10":true,
"jwt_auth_integration":0,
"amplificator_title":"",
"amplificator_subtitle":"",
"connections":[],
"auth0js-cdn":"https:\/\/cdn.auth0.com\/js\/auth0\/9.4\/auth0.min.js",
You can’t perform that action at this time.