question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Check SSO not working

See original GitHub issue

I’m trying to use

await keycloak.init({
     config: {
     url: 'url',
     realm: 'realm',
     clientId: clientId'
   },
   initOptions: {
      onLoad: 'check-sso',
      checkLoginIframe: false
   }
});

But it is still being redirected to login.

http://localhost:4200/#error=login_required&state=67f53f12-206c-44b9-83be-7eef7c982ce4

It also doesn’t work with the example provided.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
mauriciovigolocommented, Mar 8, 2018

Hello @bpalermo,

Besides using onLoad: 'check-sso' you have to specify what url patterns must be excluded from the bearer interceptor, using the bearerExcludedUrls property.

So if you want to exclude the pages ending with main you have to use it:

await keycloak.init({
  config: {
    url: 'url',
    realm: 'realm',
    clientId: 'clientId'
  },
  initOptions: {
    onLoad: 'check-sso',
    checkLoginIframe: false
  },
  bearerExcludedUrls: [
    'main$'
  ]
});

The reason it redirects to the login page is that the KeycloakBearerInterceptor sends a request to renew the token and as the user is not authenticated it will be redirected to the login page.

About your comment:

Maybe provide a way to not register ‘KeycloakBearerInterceptor’ automatically.

In the next major version I will think about it. I will also improve the documentation to clarify some aspects of the library.

Thanks!

0reactions
Rebaiahmedcommented, Jun 17, 2020

Hello @bpalermo,

Besides using onLoad: 'check-sso' you have to specify what url patterns must be excluded from the bearer interceptor, using the bearerExcludedUrls property.

So if you want to exclude the pages ending with main you have to use it:

await keycloak.init({
  config: {
    url: 'url',
    realm: 'realm',
    clientId: 'clientId'
  },
  initOptions: {
    onLoad: 'check-sso',
    checkLoginIframe: false
  },
  bearerExcludedUrls: [
    'main$'
  ]
});

The reason it redirects to the login page is that the KeycloakBearerInterceptor sends a request to renew the token and as the user is not authenticated it will be redirected to the login page.

About your comment:

Maybe provide a way to not register ‘KeycloakBearerInterceptor’ automatically.

In the next major version I will think about it. I will also improve the documentation to clarify some aspects of the library.

Thanks!

What does mean main$, and bearerExcludedUrls: is to exclude from API call URLs or routing defined in angular-routes?

Read more comments on GitHub >

github_iconTop Results From Across the Web

SSO does not work and users are getting prompted for ...
Under Advanced, check the state of Enable Integrated Windows Authentication. Ensure that the option is enabled or checked. · Go to the Security...
Read more >
[keycloak-user] check-sso not working as expected with iframe
As I've seen that the check-sso would use iframe > in a hidden request but if it is not working as expected than...
Read more >
Keycloak check-sso create - javascript - Stack Overflow
I'm trying to make some public pages, so I'm using 'check-sso'. If I have understood correctly, if the user is not logged-in, ...
Read more >
Troubleshoot single sign-on (SSO) - Google Support
This problem is almost certainly due to a configuration issue in the Identity Provider. Check your Identity Provider logs and make sure that...
Read more >
Keycloak- silent check sso is not working - adapter-javascript
Hi, I have configured keycloak-js for my project. I configured silent check sso for my project but it is being redirected to the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found