# Failed to authorize in multitenancy keycloak with credentials

**URL:** <https://forum.keycloak.org/t/failed-to-authorize-in-multitenancy-keycloak-with-credentials/19000>\
**Category:** Getting advice\
**Tags:** authentication, multi-tenancy\
**Created:** [December 13, 2022, 5:18pm UTC](https://forum.keycloak.org/t/failed-to-authorize-in-multitenancy-keycloak-with-credentials/19000 "2022-12-13T17:18:33Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![kelfhk](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/kelfhk/32/6966_2.png) [@kelfhk](https://forum.keycloak.org/u/kelfhk)\
**Post date:** [December 13, 2022, 5:18pm UTC](https://forum.keycloak.org/t/failed-to-authorize-in-multitenancy-keycloak-with-credentials/19000/1 "2022-12-13T17:18:34Z")

</div>

I was trying to follow the same multitenancy setup as the official [documentation](https://github.com/keycloak/keycloak-documentation/blob/main/securing_apps/topics/oidc/java/multi-tenancy.adoc), but with credentials in my keycloak.json file, but keycloak does not seem to authorize access token properly.

It appears to call the resolve function of my customized KeycloakConfigResolver multiple times. It does authorize the token at the first time it calls to resolve, but it then shows ‘Failed to verify token’ every time after that.

And at the end, it fails to verify my access token.

The details are posted on [stackoverflow](https://stackoverflow.com/questions/74343476/403-forbidden-when-authorizing-in-multitenancy-keycloak-with-credentials) and [github issue](https://github.com/keycloak/keycloak/issues/15391).

Could someone please help me out of the multitenancy setup with credentials? Thanks

---

<div class="post-metadata">

**Author:** ![ch4mpy](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/ch4mpy/32/5452_2.png) [@ch4mpy](https://forum.keycloak.org/u/ch4mpy)\
**Post date:** [December 13, 2022, 10:56pm UTC](https://forum.keycloak.org/t/failed-to-authorize-in-multitenancy-keycloak-with-credentials/19000/2 "2022-12-13T22:56:01Z")

</div>

[See my answer on stackoverflow](https://stackoverflow.com/a/74791753/619830)
