Verify user Relam access token on server

Hi, I was following this guide to verify a realm-generated access token on a server app. Apparently, the only way I’ve found to do so is to send the client token to this endpoint.
admin/v3.0/​groups/​{groupId}/​apps/​{appId}/​users/​verify_token

In order to be able to use it, I had to create an API key following this doc. https://www.mongodb.com/docs/atlas/configure-api-access/

I added permissions, invited & granted it permissions to the app, and also added IP access to that key.
However every time I hit the endpoint I get:

{
    "error": "EOF"
}

or

{
    "error": "app not found"
}

Not really sure why I started getting a different response at some point.

By the way, I’ve been using the “_id” of the app as {appid}, which is correct according to the docs. So that’s unlikely to be the problem.

Does anyone have an idea how to fix this or at least an alternative for verifying the access token on the server side?

Thanks!

2 Likes

I have a similar issue. Getting error 401 even though I just created the access_token.

Did you manage to figure it out?

For the {appId} make sure you’re using an objectId for the app not the short name. You can find the app id using this Atlas App Services API

or check the your url in the browser when you open an app. Note both group_id and app_id are object ids.

https://realm.mongodb.com/groups/{group_id}/apps/{app_id}/dashboard