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

Bug: ShouldAddToken is adding bearer token to every url #627

Open
gerwinbouwhuis opened this issue Feb 20, 2025 · 0 comments
Open

Bug: ShouldAddToken is adding bearer token to every url #627

gerwinbouwhuis opened this issue Feb 20, 2025 · 0 comments

Comments

@gerwinbouwhuis
Copy link

gerwinbouwhuis commented Feb 20, 2025

I use the shouldAddToken token with customBearerTokenInterceptor, but it seems like the bearer token is added to every url, if return false it still added the bearer token,
If using the urlPattern with includeBearerTokenInterceptor it, then it works like expected

const customCondition: CustomBearerTokenCondition = {
    shouldAddToken: async (req: any, next: HttpHandlerFn, keycloak: Keycloak) => {
        // Add token only for requests to the / api endpoint
        return req.url.startsWith('/api') && keycloak.authenticated;
    }
};

I think something goes wrong here, shouldAddToken is false but it 's find a matching condition
const matchingCondition = conditions.find(async condition => await condition.shouldAddToken(req, next, keycloak));

@gerwinbouwhuis gerwinbouwhuis changed the title ShouldAddToken is adding bearer token to every url Bug: ShouldAddToken is adding bearer token to every url Feb 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant