Ask Your Question
0

How can authorized API resources be utilized with a public client in Keycloak?

asked 2023-05-04 08:48:59 +0000

bukephalos gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2023-05-04 09:18:01 +0000

qstack gravatar image

Authorized API resources can be utilized with a public client in Keycloak using the following steps:

  1. Create a public client in Keycloak by navigating to Clients in the Keycloak admin console, clicking on the Create button, and selecting the Public radio button.

  2. Ensure that the client has the appropriate protocol mapper(s) to obtain an access token. This can be done by navigating to the client's settings and then the Mappers tab. Add the mapper "Audience" to the client, which will include the API resources to which the client is authorized.

  3. Set up the API resources that the client is authorized to access by adding them to the relevant realm or client. This can be done by navigating to the desired realm or client and then adding the appropriate resources under the Resources tab.

  4. Obtain an access token for the public client by sending a client_credentials grant request to the Keycloak token endpoint. Use the client's credentials to authenticate the request.

  5. Include the access token in requests to the API resources that the client is authorized to access by adding it to the Authorization header in the format "Bearer {access_token}". The API resources can then use the token to verify the authorization of the client and grant access to the requested resource.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2023-05-04 08:48:59 +0000

Seen: 14 times

Last updated: May 04 '23