Hi!
I have an HTTP Endpoint in mongo Atlas App service name: /movies which is calling a function (moviesfunc) work on a database.
I have Set API Key authentication.
I am trying to add function authentication for type User Id.
In Function settings I am trying to add Authorization function to match the API Key of the user.
I am trying to run the HTTP request in Postman.
I am selecting authentication type as API Key and setting the name and API key same as used in mongo Atlas.
the request gives error {
“error”: “rule not matched for function "moviefunc"”,
“error_code”: “FunctionExecutionError”,} or {
“error”: “cannot compare to undefined”,
“error_code”: “FunctionExecutionError”}
I have tried different Json Expresssions in Function authentication settings like this (Json Expression)
{
“$and”: [
{ “%%request.authentication.username”: “%%user.name” },
{ “%%request.authentication.password”: “%%user.id” }
]
}
But I failed. how can I add function level authentication using API Key.
Or authentication using User Id method.