This repository contains a Angular example application that demonstrates the implicit flow for OpenID Connect's.
- To add information about your keycloak configuration, go to
/src/app
- Locate
login.component.ts
in the "login" folder and upgrade the keycloak configurations. - Locate
auth.component.ts
in the "auth" folder and upgrade the keycloak configurations (same as login.component.ts)
- Locate
const keycloakConfig = {
url: "https://{hostname}/auth",
realm: "keycloak-tenant-id",
clientId: "keycloak-client-id"
}
- Clone/Download the Repository
- RUN
npm install
and wait for the completion of installation onnode_modules
- Once
node_modules
are installed, RUNnpm run start
to start execution ofng serve
. Becauseng serve
command builds your application and serves it locally. - If the app has been compiled successfully, go to browser and open
http://localhost:4200
, you will be automatically redirected tohttp://localhost:4200/auth
- Configure the OIDC details in
src/app/login/login.component.ts
andsrc/app/auth/auth.component.ts
files. - Make sure that you replace the
keycloak-tenant-id
with your TenantID andkeycloak-client-id
with your ClientID. - Modify
{hostname}
to align your keycloak domain.
Note:
- Before starting to run the angular application, please make sure that port number 4200 is available. Since 4200 is the default angular app port.
- Click on "login" button.
- You will be redirected to the user authentication screen of "Keycloak".
- Complete all of the authentication steps.
- Depending on the response type you configured, you will receive a token.
OpenID Connect is a perfect way to incorporate user authentication to your application, where you are relying on another party to handle user identity.
In this situation, Keycloak handles the identity of the users, allowing it faster to get up and running.
By integrating OpenID Connect via Keycloak, you are building a session that can be used to single sign-on from your custom app to other applications that your users can access via the Keycloak portal.
If you have any queries/you find any problems, please don't hesitate to raise an issue.