Skip to content

Instantly share code, notes, and snippets.

@rohanBagchi
Last active March 23, 2020 19:43
Show Gist options
  • Save rohanBagchi/f68a79576dfde42fb6750fe62e4a6638 to your computer and use it in GitHub Desktop.
Save rohanBagchi/f68a79576dfde42fb6750fe62e4a6638 to your computer and use it in GitHub Desktop.
exports.handler = async (event, context) => {
const {
user
} = context.clientContext;
if (user) {
const userID = user.sub;
return {
statusCode: 200,
body: JSON.stringify({
"X-Hasura-User-Id": userID,
"X-Hasura-Role": "user",
})
};
}
return {
statusCode: 200,
body: JSON.stringify({
"X-Hasura-role": "anonymous"
})
};
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment