Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to intercept M2M token in OpenFGA's API calls ? #131

Open
kishan-anva opened this issue Dec 10, 2024 · 0 comments
Open

How to intercept M2M token in OpenFGA's API calls ? #131

kishan-anva opened this issue Dec 10, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@kishan-anva
Copy link

kishan-anva commented Dec 10, 2024

Description

Sub - Issue with Bearer Token and Store Creation in OpenFGA

I'm currently working with OpenFGA and I have a custom bean that overrides the default OpenFGA bean. The goal is to ensure that a store is created only once. When creating the store, if it doesn't already exist, it should be automatically created, and the store ID should be added to other AuthorizationModel APIs.

However, I'm running into an issue. I keep getting the error message "invalid bearer token." The M2M token is being created successfully, but for some reason, it’s not being properly intercepted when the store is created within the custom bean. This is causing the token to be invalid during the API calls.

As a workaround, I tried switching to direct API calls using the RestClient to call OpenFGA APIs. The RestClient provides an option for requestInterceptor(), but I’m struggling to set the M2M token in the header correctly. Despite my efforts, the token is still not being passed correctly, and I continue to face authentication issues.

Has anyone encountered a similar problem or have any advice on how to intercept and set the M2M token in the header when using the RestClient? Any insights or solutions would be greatly appreciated!

Thanks in advance!

Version of SDK

v0.4.0

@kishan-anva kishan-anva added the bug Something isn't working label Dec 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Backlog
Development

No branches or pull requests

1 participant