keycloak-angular | Easy Keycloak setup for Angular applications | Identity Management library
kandi X-RAY | keycloak-angular Summary
kandi X-RAY | keycloak-angular Summary
This library helps you to use keycloak-js in Angular applications providing the following features:.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of keycloak-angular
keycloak-angular Key Features
keycloak-angular Examples and Code Snippets
Community Discussions
Trending Discussions on keycloak-angular
QUESTION
I'm trying to integrate keycloak-angular in my angular application. The authentication flow works well, however when I make a request to my django api I get a 403. The HTTP_AUTHORIZATION header is missing and I don't understand why. When I hardcoded a header in my http service it worked.
This is the library:
This is my keycloak config
...ANSWER
Answered 2022-Mar-30 at 09:08Seems you’re missing a configuration line, take a look at https://www.npmjs.com/package/keycloak-angular#httpclient-interceptor. enableBearerInterceptor: true which will add the interceptor for you.
I don’t know if you even need that line because it’s active by default.
Another issue could be that (would need some insight into the code , but this is purely on speculation) if the token was not added in module/submodules where HttpClient requests were made then it would not been adding the token in http call.
QUESTION
I'm trying to implement keycloak-angular but I'm not able to add the bearer token by default to my http requests.
"keycloak-angular": "9.1.0" "keycloak-js": "16.0.0" "Angular": "13.0.2"
...ANSWER
Answered 2022-Mar-07 at 15:29You have to use an HttpInterceptor to add custom headers at each api call. Create your interceptor, and add it to AppModule
QUESTION
I have an Angular App with a Keycloak authentication system (keycloak-angular)
I have a Grafana server which allow authentication with OAuth Keycloak
I have a Keycloak Server with a realm called master, and two cliendID , one for my angularApp, and one for my grafana server.
In my angular App, I display some iframes coming from my Grafana Server, and with my actual configuration, my Iframes are directly authenticated with OAuth (there is no login screen).
I have a logout button in my angular App to process a Keycloak logout, which redirects me to the keycloak login screen.
My problem is that Iframe sessions are saved when I perform a keycloak logout, and if after that I login with a different user, my grafana iframe will still be authenticated with the previous user.
If I logout inside the grafana app, or the grafana iframe, or go to http://grafana-server:3000/logout , I will get logged out to Grafana, and the grafana iframe session will switch to the new one (the user which is logged in my angular app).
I want the grafana iframe to perform a sign out when I logout from my Angular App, so the next user logged in will not have the session of the previous user.
Grafana OAuth Section :
...
ANSWER
Answered 2021-Dec-16 at 11:35OIDC logout has redirect_uri
parameter, where user is redirected after logout, so use it to logout from Grafana as well. Desired flow:
Angular logout redirects browser to OIDC logout
https://keycloak-server/auth/realms/{realm-name}/protocol/openid-connect/logout?redirect_uri=
(of coursegrafana logout url
is URL parameter so it must be URL encoded)Keycloak after succesfull OIDC logout redirects browser to
("your" http://grafana-server:3000/logout), because it was instrumented to do that with
redirect_uri
parameterGrafana executes logout (Grafana user session in the browser will be destroyed) and browser will be redirected to Grafana login page (that can be of course customizes with
signout_redirect_url
config)
QUESTION
When we are trying to update our Angular 9 application(Single SPA micro frontend) to Angular 12 we are facing bellow issue.
Error on console when trying to run this app:
...ANSWER
Answered 2021-Dec-16 at 14:06kindly update the custom-webpack with ^12.1.3
QUESTION
I'm trying to redirect to an unauthorized route when a role tries to access an unauthorized route, I'm using keycloack-angular lib:
npm install keycloak-angular keycloak-js
My Guard
...ANSWER
Answered 2021-Dec-14 at 19:02You haven't used the router instance to redirect to another route when access is not allowed. Call the navigate statement to redirect wherever you return false
:
QUESTION
I would like to call a webservice beforce initializing keycloak frontend component from keycloak-angular library to make keycloakconf dynamic. The backendService.keycloakConfig() webservice returne the correct value but the isInitialized variable is always false.
I think mixing the Promise and the Observable is messing with the initialization.
Here is the code :
...ANSWER
Answered 2021-Dec-10 at 06:21I'm not great with Angular, so there's probably a better way to do exactly what you want, and I'd love to hear it because I'd like to do the same thing.
What I've settled on is on the un-authed pages (landing/splash page pre-login) is to fetch the configuration data and stick it in session storage:
QUESTION
I am very new to the angular project. After I clone the project and try to up the project with ng serve
.
So I am getting an error like.
...ANSWER
Answered 2021-Aug-30 at 05:56Considering you tagged angular6
, I suggest you upgrade to the latest supported angular version by KeyCloack
. As mentioned here you can and probably should upgrade to angular 12:
QUESTION
I'm trying to execute the following tutorial to integrate an Angular 12 application with Keycloak: Keycloak Integration with Angular Frontend (I've checked other similar tutorials and the instructions are the same).
As described in the article, I've inserted the following lines in src\environments\environment.ts
:
ANSWER
Answered 2021-Jun-12 at 08:00the latest library guide does not contain any "credentials" in the configuration. try removing this piece at all, it shouldn't be there
QUESTION
In my application, i'm using react with keycloak authentication. And i'm trying to secure my back end vertx APIs using the received token from keycloak. I followed this blog http://paulbakker.io/java/jwt-keycloak-angular2/
i'm calling like this from react
...ANSWER
Answered 2021-May-04 at 13:57first of all, JWTAuthOptions
will do nothing with what you have set under key "public-key"
as it does not have any property that maps to it (even if it was possible in Java to have a -
in property names). So either set your values on JWTAuthOptions
directly using setters or consult documentation for proper keys.
Second, if your Keycloak is setup with OIDC, then you can simply use OpenIDConnectAuth
class that discovers the necessary parameters from Keycloak automatically. Which is way easier.
QUESTION
I have an Angular 9 application. Trying to connect with Keycloak server. My final goal is to have SSO for 3 applications, with auth-guard on each (access only some pages requires authentication).
Having multiple issues, but let do one at a time.
Using keycloak-angular with keycloak-js.
When I do keycloak.login() (with or without redirectUri) most of the time it goes to keycloak/auth page and comes back authenticated - without waiting for user input. I did double-check not to save any user data in browser autofill.
I will share more data upon request.
Update:
I see in the Keycloak console, that even after logging out, the session is still active. using:
...ANSWER
Answered 2021-Feb-26 at 21:53It looks like you don't have proper logout.
You have to visit your identity provider (Keycloak in this case) OIDC logout endpoint for correct OIDC logout - just navigate whole browser (background AJAX/axios call doesn't work!) to:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install keycloak-angular
In order to make sure Keycloak is initialized when your application is bootstrapped you will have to add an APP_INITIALIZER provider to your AppModule. This provider will call the initializeKeycloak factory function shown below which will set up the Keycloak service so that it can be used in your application. Use the code provided below as an example and implement it's functionality in your application. In this process ensure that the configuration you are providing matches that of your client as configured in Keycloak. In the example we have set up Keycloak to use a silent check-sso. With this feature enabled, your browser will not do a full redirect to the Keycloak server and back to your application, instead this action will be performed in a hidden iframe, so your application resources only need to be loaded and parsed once by the browser when the app is initialized and not again after the redirect back from Keycloak to your app. To ensure that Keycloak can communicate through the iframe you will have to serve a static HTML asset from your application at the location provided in silentCheckSsoRedirectUri.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page