Guys please I need your help.
I’m trying to access HTTPS Endpoint using JWT or user access token
My JWT payload looks like this:
{
"aud": "app_id",
"sub": "user@mydomain.com",
"iat": 1641459284,
"exp": 1704459073
}
Now when I call the endpoint
curl --location --request POST 'https://eu-central-1.aws.data.mongodb-api.com/app/app_id/endpoint/someEndpoint?secret=1234 \
--header 'jwtTokenString: My_JWT_Token' \
--header 'Content-Type: application/json'
I get the following error:
{"error":"invalid session: error finding user for endpoint","error_code":"InvalidSession","link":"https://realm.mongodb.com/groups/error_log"}
I get the same error when calling the endpoint with the client access token in the header.
{"error":"invalid session: error finding user for endpoint","error_code":"InvalidSession","link":"https://realm.mongodb.com/groups/error_log"}
I tried verifying the access token, refreshing the access token, even deleting the user and creating it again without success.
However, if I call the endpoint by sending the email and the password in the request data, then it works.
I have been struggling with this problem for 3 days now your help is very much appreciated.
Thanks in advance.