Issue while registering user using admin token

I have created a new realm,and a client and in user section i created user and assigned roles of realm-management when i used this api in postman

http://<KEYCLOAK_URL>/auth/admin/realms/<REALM_NAME>/users (replacing with our details)

{

        username = username,

        enabled = true,

        email = email,

        firstName = firstName,

        lastName = lastName,

        credentials = new[]

        {

            new

            {

                type = "password",

                value = password,

                temporary = false

            }

        }

    })

by passing all details, it throws 401 unauthorized, i passes the token in headers which i got from admin api

do u think i missed anything like assign roles to user or any client setting so that token should have authority and not throw any error

Try the role realm-admin instead

Using a sledgehammer to crack a nut? :thinking:
If the role is the cause, the „manage-users“ role would be sufficient. „manage-realm“ is for realm settings, not users. And „realm-admin“ is, … well, admin for complete realm.

A 401 yields to an invalid or none token. A wrong role would yield into a 403.