keycloak-angular icon indicating copy to clipboard operation
keycloak-angular copied to clipboard

Using `assets/` instead of `/assets` in examples

Open mibnd opened this issue 2 years ago • 0 comments

Hey! Maybe using assets/ instead of /assets in examples with bearerExcludedUrls like below can cover more use cases because request URL can start with assets without leading / like this example assets/example.file and will not be excluded from adding bearer process. What do you think about this?

await keycloak.init({
  config: {
    url: 'http://localhost:8080',
    realm: 'your-realm',
    clientId: 'your-client-id'
  },
  initOptions: {
    onLoad: 'check-sso',
    silentCheckSsoRedirectUri:
      window.location.origin + '/assets/silent-check-sso.html'
  },
  bearerExcludedUrls: ['assets/', '/clients/public'],
  shouldUpdateToken: (request) => {
    return !request.headers.get('token-update') === 'false';
  }
});
Diff
await keycloak.init({
  config: {
    url: 'http://localhost:8080',
    realm: 'your-realm',
    clientId: 'your-client-id'
  },
  initOptions: {
    onLoad: 'check-sso',
    silentCheckSsoRedirectUri:
      window.location.origin + '/assets/silent-check-sso.html'
  },
- bearerExcludedUrls: ['/assets', '/clients/public'],
+ bearerExcludedUrls: ['assets/', '/clients/public'],
  shouldUpdateToken: (request) => {
    return !request.headers.get('token-update') === 'false';
  }
});

mibnd avatar Aug 25 '22 05:08 mibnd