Skip to content
This repository has been archived by the owner on Apr 19, 2023. It is now read-only.

403 Forbidden on a newly created Realm #468

Closed
SimonMARTIN87 opened this issue Apr 28, 2022 · 3 comments
Closed

403 Forbidden on a newly created Realm #468

SimonMARTIN87 opened this issue Apr 28, 2022 · 3 comments

Comments

@SimonMARTIN87
Copy link

Describe the bug

When creating a new realm (using a client with all needed roles), it seems the promise is resolved BEFORE the realm is completely setup.
Trying to retrieve this realm will result in a 403 Forbidden result.

Version

server 17.0.1, npm package 18.0.0

Expected behavior

the newly created realm should be retrieved.

Actual behavior

403 Forbidden.
Waiting a couple of seconds between the create and the find results in a correct behavior.

How to Reproduce?

import KCAdminClient from '@keycloak/keycloak-admin-client';
const service = new KCAdminClient({
    baseUrl
});

await service.auth({
  clientId,
  clientSecret
  grantType: 'client_credentials',
});

const newName="test";
const {realmName} = await service.realms.create({
    realm: newName,
    enabled: true,
    ...
});

const realmObj = await service.realms.findOne({
    realm: realmName
});

Anything else?

I'll try with server version 18 today and will update this issue.

@timeisgolden
Copy link

timeisgolden commented May 5, 2022

I also got 403 errors when launching service.realms.find()

Request URL: 
https://auth.eks.dev.onemindtechnologies.com/auth/admin/realms/onemind-ng/roles
Result:
{error: "unknown_error"}
error: "unknown_error"

plz, help me so that I fix this issue.

@timeisgolden
Copy link

Describe the bug

When creating a new realm (using a client with all needed roles), it seems the promise is resolved BEFORE the realm is completely setup. Trying to retrieve this realm will result in a 403 Forbidden result.

Version

server 17.0.1, npm package 18.0.0

Expected behavior

the newly created realm should be retrieved.

Actual behavior

403 Forbidden. Waiting a couple of seconds between the create and the find results in a correct behavior.

How to Reproduce?

import KCAdminClient from '@keycloak/keycloak-admin-client';
const service = new KCAdminClient({
    baseUrl
});

await service.auth({
  clientId,
  clientSecret
  grantType: 'client_credentials',
});

const newName="test";
const {realmName} = await service.realms.create({
    realm: newName,
    enabled: true,
    ...
});

const realmObj = await service.realms.findOne({
    realm: realmName
});

Anything else?

I'll try with server version 18 today and will update this issue.

Did you solve this issue?
@SimonMARTIN87

@timeisgolden
Copy link

never mind, I solved the issue by adding manage-realm in realm-management to my account in keycloak console.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants