Login with Keycloak integartion on MAUI application

Sreejith Sreenivasan 691 Reputation points
2024-05-09T11:11:20.79+00:00

Is it possible to integrate the login feature with keycloak?

Currently we are using back end API for login and after that we are redirecting the user to home page. Instead we need to add a login button on the UI and when tapping on it we need to open the keyclok login page and over there the user will login. After login it will return a token and we need to fetch that value on the app.

I saw Web authenticator can do the browser-based authentication and listen for a callback. But on Web authenticator where I should pass the keycloak domain, realm name and other required properties?

I saw a lot of packages, which one is suitable for my requirements.

CbOM90tr

I research for a long time but didn't get any useful blogs.

.NET MAUI
.NET MAUI
A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
2,961 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Bruce (SqlWork.com) 57,646 Reputation points
    2024-05-10T01:14:47.9633333+00:00

    It depends. Keycloak appears to support oauth. There a two common approaches to oauth authentication on mobile. They both use a webview control to login, as the oauth server is a website that redirects back to the host site.

    the first is you have a website that handles the login and returns a token to the mobile app. as the token response is a webpage, you need to get the token to app. Your app can parse the response or use JavaScript to call the mobile app code.

    The second uses registered custom protocol on mobile app, and the oauth server redirects to this protocol. Again you mobile app parses the response.

    0 comments No comments