Skip to content

Instantly share code, notes, and snippets.

View joshcanhelp's full-sized avatar
👋
Open to new connections!

Josh Cunningham joshcanhelp

👋
Open to new connections!
View GitHub Profile
@joshcanhelp
joshcanhelp / SetAccessTokenCookie.php
Last active February 6, 2019 01:38
Auth callback middleware to set an access token in Laravel
<?php
// app/Http/Middleware/SetAccessTokenCookie.php
namespace App\Http\Middleware;
use Closure;
class SetAccessTokenCookie
{
/**
@joshcanhelp
joshcanhelp / laravel-auth0.php
Last active January 29, 2019 23:32
Laravel config settings for Auth0 API authentication
<?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 January 29, 2019 23:34
Laravel middleware for access token verification on an API
<?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 February 11, 2020 17:55
Google Script Editor functions for getting SDK quality metrics
/* globals SpreadsheetApp, Browser, CacheService, UrlFetchApp, PropertiesService */
/*
*
* Macro functions
*
*/
/**
* Prompt the user for a GitHub API token.
function login (email, password, callback) {
console.log(email);
var request = require("request");
request.post(
"[APP_ENDPOINT_HERE]",
{
form: {
@joshcanhelp
joshcanhelp / get_connection.json
Created October 10, 2018 21:14
Sample get connection response
{
"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 June 26, 2018 16:54
How the Lock options object should look in View Source
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 June 6, 2018 17:36
Copy git repo tags to an svn directory
#!/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 July 2, 2018 23:18
Generate a WP instance locally - WIP
#!/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 20:08
Default WP-Auth0 settings for reset
{
"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",