Problem using custom JWT Token when using GraphQL

Issue
When accessing the GraphQL endpoint of realm via the code below. Error authentication via 'custom-token' is unsupported is always returned via the endpoint.

import requests

url = 'https://realm.mongodb.com/api/client/v2.0/app/app-id/graphql'

headers = {
    'jwtTokenString': jwt_token
}

r = requests.post(url, json={'query': query}, headers=headers)
print(r.json())

Steps Done

  1. Enabled the Custom JWT Authentication, supplied the RSA Public Key since our system uses RS256 for JWT encoding.
  2. The JWT was created has the following payload structure:
    {
    ‘aud’: aud,
    ‘sub’: ‘user-1’,
    ‘exp’: exp
    }

Hey Marnell, generally when we see the authentication via 'custom-token' is unsupported it means that the changes for your Custom JWT authentication were not deployed or you did not toggle the provider to ‘Enabled’. If that’s not the case, I can take a closer look if you link your app

Hi Sumdedha, I did toggle it (see the screenshot).

[Uploading: image.png…]

If you need the application id, this is the application id

application-0-suxcm

NOTE: I’m just using the free tier for now since I am just experimenting of our use cases. But we will soon upgrade to premium.

Hey Marnell - After toggling it, make sure you hit “Save” and then “Deploy” in the Blue banner that appears on the top. Looking at your app, it seems like the JWT authentication is turned off and you didn’t add a signing Key.

2 Likes

After clicking the review and deploy its Now okay Sumedha. Thank you very much for the support!

1 Like

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.