Does anyone know how to check a Auth0 session in NodeJS (window object is not available)?
I’ve authenticated the user on the frontend. And I’m able to check a session. But I’d like to perform the check session in a serverless function using NodeJS.
How can I do this?
What do I need to send to the endpoint in the URL or headers?
And can I use the npm auth0 package in a netlify function?
I’m getting this error: Error during invocation: TypeError: n is not a function
My use case is to make it simple for customers to authenticate themselves on the website without creating an account using the traditional password & username.
Upon authentication I want to protect Netlify serverless API endpoints to only allow passwordless authenticated users to invoke them.
If your users are authenticated on your website, (lets call it a SPA in this example) then you will only need to send an access token with the API call, and have the serverless function verify the token. Take a look at the following doc which lays out the scenario:
@dan.woda from what I’ve read. I can only access the user profile information with the getUserProfile method. Providing the opaque token sent back from a successful passwordless authentication flow.
I have a question: using the passwordless authentication flow, which successfully sends back an opaque token. How can I then get a valid JWT token?
You must add an audience claim. This requests a token that can be verified by your custom API. If you are looking to display information in your application based on the token then you will want to use an id token: