简体   繁体   中英

How to authenticate an asynchronous task with an API protected by Keycloak?

I'm analyzing the feasibility of using KeyCloak in a microservices architecture, where there are asynchronous tasks that perform actions on APIs of other services.

The authentication flow that starts with a user action, whether in a mobile or web application, using Keycloak was clear, but I didn't understand how a system can authenticate itself with another system. Does KeyCloak support this type of scenario?

For example:

Every day at 12pm it is necessary to analyze the quantity of a product and make requests to the supplier's API. How will the worker authenticate with the products API using KeyCloak?

You use the client credentials flow to authenticate between services, ie for machine-to-machine communication.

One stragegy is to use the authorization code flow with the users and then client credentials between services on the backend, like this:

在此处输入图像描述

You can read more about it with Keycloak here

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM