Authorized API resources can be utilized with a public client in Keycloak using the following steps:
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.
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.
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.
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.
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.
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
Asked: 2023-05-04 08:48:59 +0000
Seen: 14 times
Last updated: May 04 '23
How can I create a monitor in Datadog that includes multiple resources' metrics in one monitor?
What is the process of authentication for tokens in Firebase Cloud Messaging?
How can mutual authentication be implemented on a development server for a Django web application?
What does receiving a 401 error from Netsuite REST API imply?
How can Google OAuth be integrated with FastAPI?
What is the method to only render components on the client side in NextJS 13?