To make an authenticated request, we will need to get logged in users auth tokens from Auth0. Auth0 exposes a getAccessToken
function that we can use in Next.js getServerSideProps
to fetch the user token. It's important to note that this function can only be used server side. We'll pass that token into the page we need to send authed requests.
To enable Apollo Client to set the headers we'll extend the client so that allows us to pass in auth tokens and sets the client context. We will then destructure the client from our useMutation
hook and set the context to include the user token.
Hello, amazing course so far, my auth token is being appeneded to my request but I'm getting "Error: Invalid database secret."
Hey would you be able to share your code. I can take a look.
I solved it, I had copied and pasted the default AUTH0 set up without generating the AUTH0_SECRET.
I am having the same problem, I have already generated the AUTH0_SECRET in the .env.local now what? I am stuck here
Solved with help of instructor.
It was my mistake
I have the same problem of "Error: Invalid database secret." how to solve it?
Can you share your code please. I can help you debug this.