Skip to content
Permalink
Browse files

auth

  • Loading branch information...
swyx sw-yx
swyx authored and sw-yx committed Nov 6, 2018
1 parent beb77c6 commit 024620a2d9bbed9bcb667b107555bad7e6396b4a
Showing with 28 additions and 2 deletions.
  1. +2 −1 .gitignore
  2. +1 −1 netlify.toml
  3. +25 −0 src/lambda/auth-hello.js
@@ -67,4 +67,5 @@ yarn-error.log
.pnp.js
# Yarn Integrity file
.yarn-integrity
lambda
/lambda
.netlify
@@ -1,4 +1,4 @@
[build]
Command = "yarn build"
Command = "npm run build"
Functions = "lambda"
Publish = "build"
@@ -0,0 +1,25 @@
// from https://www.netlify.com/docs/functions/#identity-and-functions

// Note that `netlify-lambda` only locally emulates Netlify Functions, while `netlify-identity-widget` interacts with a real Netlify Identity instance. This means that `netlify-lambda` doesn't support Netlify Functions + Netlify Identity integration.

export function handler(event, context, callback) {
if (context.clientContext) {
const { identity, user } = context.clientContext
callback(null, {
statusCode: 200,
body: JSON.stringify({
msg: 'auth-hello: ' + Math.round(Math.random() * 10),
identity,
user,
}),
})
} else {
// callback(new Error('error'))
callback(null, {
statusCode: 200,
body: JSON.stringify({
hoo: 'bar',
}),
})
}
}

0 comments on commit 024620a

Please sign in to comment.
You can’t perform that action at this time.