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

[keycloak-js] Add "cordovaOptions" to "init" function #15

Open
fgattu opened this issue Jun 9, 2023 · 7 comments
Open

[keycloak-js] Add "cordovaOptions" to "init" function #15

fgattu opened this issue Jun 9, 2023 · 7 comments
Assignees

Comments

@fgattu
Copy link

fgattu commented Jun 9, 2023

Description

Hi,
since Safari, starting from version 13, blocks third-party cookies and, for this reason, check-sso cannot be used, would it be possible to add the "cordovaOptions" configuration also to the "init" function?

Thank you

Discussion

No response

Motivation

No response

Details

No response

@jonkoops jonkoops self-assigned this Jun 9, 2023
@jonkoops
Copy link
Contributor

jonkoops commented Jun 9, 2023

Can you elaborate why the cordovaOptions should be added to the init() function? I see you have drawn the conclusion that this resolves the issue somehow, but you have provided no details as to how.

@fgattu
Copy link
Author

fgattu commented Jun 9, 2023

Hi Jon,
since it is not possible to use the "onLoad" option with the "check-sso" for the problem described above, I'm forced to use the "login-required" option.
The problem exists only for apps (for example Ionic apps), because the Keycloak login page is opened with the Cordova Inappbrowser plugin which cannot be customized in the "init" function (today the "cordovaOptions" can only be passed to the "login" function).

@jonkoops
Copy link
Contributor

jonkoops commented Jun 9, 2023

So what would be the options you want to pass into cordovaOptions?

@fgattu
Copy link
Author

fgattu commented Jun 9, 2023

The same ones that are passed in the "login" function (https://cordova.apache.org/docs/en/11.x/reference/cordova-plugin-inappbrowser/#cordovainappbrowseropen).

For example:
cordovaOptions: { toolbar: 'no', footer: 'no' }

@jonkoops
Copy link
Contributor

Right, I understand that you want to pass these arguments in. But I have still not seen an example of how that fixes this specific issue.

@fgattu
Copy link
Author

fgattu commented Jun 12, 2023

I have the following problem: I'm developing an Ionic app which has Keycloak as the authentication provider.
For apps, the login page is displayed via the Inappbrowser plugin, so my idea was to initialize it with the "init" function passing the "onLoad:check-sso" option and then, call the "login" function passing the "cordovaOptions" to be able to customize the Inappbrowser page.
Later, I discovered that the "onLoad: check-sso" option with Safari no longer works because it does not accept third-party cookies, so I have to initialize Keycloak passing "onLoad: login-required" which causes the 'immediate opening of the login page with the Inappbrowser plugin which cannot be customized because the options of the "init" function do not allow it (https://www.keycloak.org/docs/latest/securing_apps/#methods).
I would like to know if it is possible to add cordovaOptions to the "init" options to customize the Inappbrowser page.

@jonkoops
Copy link
Contributor

I don't think we want to add adapter specific configuration options to the init() method. Ideally this is done by configuring the adapter itself.

In my opinion the init() method already does too much, and should be refactored into different methods (which could accept these arguments). This would tie into a larger refactoring of Keycloak JS, so will likely take some time before we could get to this.

@jonkoops jonkoops transferred this issue from keycloak/keycloak Feb 3, 2025
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

2 participants