Last active
March 23, 2020 19:43
-
-
Save rohanBagchi/f68a79576dfde42fb6750fe62e4a6638 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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