AkrosAG / Akros-Marketplace

Apache License 2.0
3 stars 5 forks source link

Research how to create a custom login popup #151

Open ghost opened 2 years ago

ghost commented 2 years ago

Multiple stories have popped up, that require a popup - #146 , #18 , #40 . A research how to achieve that is a requirement:

ghost commented 2 years ago

After some digging - angular-oauth2-oidc provides a way to open keycloak's login page into a popup - docs.

The steps should be:

  1. Create a silent-refresh.html static page(an example one can be found here);
  2. Add the page as a static resource into the angular project(the easiest way is to add the html file into the assets folder).
  3. Add a URL to the silent-refresh.html page to the configuration of angular-oauth2-oidc - silentRefreshRedirectUri property(if added to assets should be something like http://localhost:4200/assets/silent-refresh.html)
  4. Add the URL as a valid redirect url for the client in keycloak - select the realm -> Clients -> the client used by the app -> Valid redirect URIs)
  5. Execute initLoginFlowInPopup method from angular-oauth2-oidc

Additional notes:

ghost commented 2 years ago

Small example POC

login-popup-poc.zip