manfredsteyer / angular-oauth2-oidc

Support for OAuth 2 and OpenId Connect (OIDC) in Angular.
MIT License
1.89k stars 688 forks source link

Re Login with new Scope #1398

Open EnricoMessall opened 7 months ago

EnricoMessall commented 7 months ago

Describe the bug Can't say if it is a bug fully. In Keycloak-Angular + Keycloak-JS i was able to use

const options: KeycloakLoginOptions = {
            locale: this.locale,
            prompt: 'login',
            scope: 'custom_scope',
            redirectUri: window.location.href
};
void this.auth.login(options);

to redirect to keycloak and require a second login to access a scope that grants a role to access own account data. That role was then added to the new JWT token but the scope not as it is configured (Disabled include in token scope). With angular-oauth2-oidc it is also possible to do a initImplicitFlow with the additional params for example the custom scope but the request fails because angular-oauth2-oidc adds the scope of the config "openid profile email" to the url and another scope parameter for "custom_scope". Is that a wanted behaviour that the params do not merge and is there a solution to fix that or is it a bug?

To Reproduce Steps to reproduce the behavior:

  1. Create function with initImplicitFlow additional parameters "prompt: login" and "scope: custom_scope" that scope needs to be in the auth provider
  2. Trigger function to do login
  3. Auth Error happens

Expected behavior Scopes are merged together

Desktop (please complete the following information):