Skip to content

Instantly share code, notes, and snippets.

View BryceAMcDaniel's full-sized avatar

BryceAMcDaniel

View GitHub Profile
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@BryceAMcDaniel
BryceAMcDaniel / getToken.ts
Created December 23, 2019 15:34
auth0 specific withApolloHOC for use with SSR in next.js.
import auth0 from '../../lib/Auth0/config';
export default async function session(req, res) {
try {
// console.log(req);
const { accessToken } = await auth0.getSession(req);
if (accessToken) res.send(accessToken);
res.status(500).end(accessToken);
} catch (error) {
@BryceAMcDaniel
BryceAMcDaniel / getToken.ts
Created December 23, 2019 15:34
auth0 specific withApolloHOC for use with SSR in next.js.
import auth0 from '../../lib/Auth0/config';
export default async function session(req, res) {
try {
// console.log(req);
const { accessToken } = await auth0.getSession(req);
if (accessToken) res.send(accessToken);
res.status(500).end(accessToken);
} catch (error) {