AppAuthGuard - (401) Unauthorized after login
See original GitHub issueBug Report or Feature Request (mark with an x
)
- [x] bug report -> please search for issues before submitting
- [ ] feature request
Versions.
keycloak-angular: 4.0.0 angular: 6.1.10 keycloak: 4.8.1.Final
Repro steps.
Follow example for keycloak-heroes to add AppAuthGuard.ts
The log given by the failure.
No Authorization: Bearer + token
in request
(401) Unauthorized
Desired functionality.
The documentation says that the Authorization
header is added automatically, but it seems to not be the case for me. I am using Http
that comes from DI in Angular.js. I know that my Keycloak instance works. I originally had my OIDC going through the server instead of the client. All I have updated is removed the middleware from the server and moved the OIDC flow to the client code. The sign in works as expected, but the request to my API is no longer working.
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (1 by maintainers)
Top Results From Across the Web
Login request is always 401 Unauthorized with AuthGuard
Unfortunately, I always receive a Unauthorized response when trying to do a login request. I think the problem comes from my super.
Read more >How to Quickly Fix the 401 Unauthorized Error (5 Methods)
“401 Unauthorized”; “Access Denied”. These errors occur on websites that require a login in order to access them. In most cases, it means...
Read more >401 Error: 5 Ways to Troubleshoot and Fix It - Hostinger
The 401 Unauthorized error is triggered by unauthenticated requests made to a WordPress web server. Learn how to identify and fix the issue....
Read more >401 Unauthorized - HTTP - MDN Web Docs
This status code is sent with an HTTP WWW-Authenticate response header that contains information on how the client can request for the resource ......
Read more >HTTP 401 Unauthorized Error | What Is and How to Fix?
Do you encounter an HTTP error 401 unauthorized access is denied when you want to login on a website? The 401 Unauthorized Access...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Awesome. I was thinking HttpClient was the underlying to Http. Thanks, refactoring to HttpClient worked for everything.
Hi @bdparrish,
The Authorization header is added automatically only with HttpClient introduced in Angular v4.3. The reason for this is that the HttpInterceptor only works with HttpClient.
I just tried the keycloak-heroes example and it seems that there is a problem with opendota-api. That is the reason I’m working on the new examples including a simple server demo, using express. This server example will be the backend for all client examples - heroes, events, uma and a ionic.
Just confirm which Http implementation you are using. With Http it won’t work.