React Kinde with FastAPI python
I have react application and I'm using there react sdk for kinde with provider. Now i have access token from react app
My goal is to grab this access token from react app pass it into Headers and make an API call to my FastAPI python backend.
How i can validate this access token on my backend ?
7 Replies
Hi there,
Thanks for your question. Here's how you can handle access token validation between your React frontend and FastAPI backend using Kinde:
---
Frontend – React:
Use the Kinde React SDK to retrieve the access token and include it in the
Authorization
header when making API requests to your backend:
---
Backend – FastAPI (Python):
To validate the token on your FastAPI server, follow these steps:
1. Install the Kinde SDK:
2. Configure the Kinde client:
3. Validate the access token:
---
Additional Notes:
- Make sure your API is registered in the Kinde dashboard.
- Define an audience for your API – this ensures the token includes the correct aud
claim.
- When using the React SDK, the audience is typically set automatically.
- Keep in mind: the kinde_client
instance stores the access token internally, so you’ll need to create one per user session.
Let me know if you'd like help setting up the audience or if you run into any issues during integration.in which format it's accept access token in kinde_client.is_authenticated_token?
Hi,
The
🔗 https://docs.kinde.com/developer-tools/sdks/frontend/react-sdk/#test-sign-up Here’s an example of what the token might look like: This is the raw JWT string you should send from the React frontend to your Python backend. On the backend, you can extract the token from the
is_authenticated_token
method expects the access token in raw JWT string format.
If you're using the React SDK, you'll receive the correct format automatically when calling getAccessToken()
. You can refer to the documentation here:🔗 https://docs.kinde.com/developer-tools/sdks/frontend/react-sdk/#test-sign-up Here’s an example of what the token might look like: This is the raw JWT string you should send from the React frontend to your Python backend. On the backend, you can extract the token from the
Authorization
header and pass it directly to is_authenticated_token()
:
The token includes standard JWT claims like aud
, exp
, and iss
, which Kinde validates internally when you call this method.
Let me know if you need help implementing this or debugging a specific case!Hijacking this support thread because the given solution doesn't work. is_authenticated_token() expects a dict and calls is_expired() on the given token - so passing in request.headers.get('Authorization').replace('Bearer ', '') as suggested, which is obviously a string because as stated it is just the "raw JWT string", throws an error.
Calling "get_claim_token" actually does validate the token internally and return the requested claim, however since it is internal, the validation cannot be modified, like validating additional claims etc. It's do weird to me that the library doesn't state at ALL what "token_value" is actually supposed to be. It is clearly not just a "dict", since "is_expired()" would throw an error on that as well.
Is there actual real support here that can answer this question? If the solution is just "the Python SDK doesn't support built-in JWT validation yet, use a third-party library to validate and call the Kinde API to get further information like user roles etc.", then STATE THAT PLEASE instead of giving half-baked solutions.

The is_authenticated_token method expects the access token in raw JWT string format.How is it possible that the "support" here blatantly misstates your own API?
Hi @Straegge,
Thank you for jumping in and raising these concerns — you’re absolutely right to call out the confusion, and I appreciate your detailed explanation.
You're correct: the
is_authenticated_token()
method does not accept a raw JWT string as input, and my earlier response was incorrect on that point. I appreciate your patience and want to offer a more accurate approach.
The correct way to validate a JWT access token issued by Kinde using the Python SDK is to manually validate the token using the SDK’s JWKS support and a JWT decoding library, like this:
For additional security and flexibility, you can also validate the token using a standalone JWT library without depending on the SDK. In that case, you can fetch the JWKS directly from:
https://<your_kinde_subdomain>.kinde.com/.well-known/jwks
Make sure your API is registered in the Kinde dashboard, and that your React frontend includes the audience parameter when initializing the Kinde provider:
<KindeProvider audience="<your_api>">
Let me know if you'd like help implementing this or if you run into any issues.