Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open keycloak login page in embedded browser #2

Open
GLY-JeffreyTCK opened this issue May 12, 2023 · 3 comments
Open

Open keycloak login page in embedded browser #2

GLY-JeffreyTCK opened this issue May 12, 2023 · 3 comments

Comments

@GLY-JeffreyTCK
Copy link

Hi, this article is awesome but can this open in embedded browser ?

@JohannesBauer97
Copy link
Owner

I haven't done it yet, but I'd start with the openUri config:

/**
 * This property allows you to override the method that is used to open the login url,
 * allowing a way for implementations to specify their own method of routing to new
 * urls.
 */
public openUri?: (uri: string) => void = (uri) => {
  location.href = uri;
};

Override this to use the embedded browser plugin of your choice.
When the user completes login and Keycloak redirects back, it might work automatically, or you need to manually listen for the redirect back parameters and provide them to the oauth2 library.

@GLY-JeffreyTCK
Copy link
Author

@JohannesBauer97 yeah i just tried out with openUri config and it works with Code + PKCE flow with your code in login function but the redirect back after logged in always got "Validating access_token failed, wrong state/nonce" issue so hasValidAccessToken always false then have to reinit login function only able to retrieve access token

@hmoazzem
Copy link

hmoazzem commented Aug 3, 2023

@JohannesBauer97 @GLY-JeffreyTCK have you managed to solve this? I've a kinda working demo at https://github.com/edgeflare/keycloak-angular-capacitor, but it's certainly not fit for production.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants