KEYCLOAK-2821 : Add the adapter option
You just can add an 'adapter' option to the kc.init() function like : kc.init({adapter: "default | cordova"}); This will allow the users to choose the adapter they want. They can force the use of the default adapter even if they are using cordova or use the cordova adapter even if they are using a regular desktop. If you omit this parameter, it just fallback to the old way. So, if you are under cordova it will run the cordova adapter and if you are under a desktop, it will load the default adapter instead. Hope this can help.
This commit is contained in:
parent
9e3fa4b566
commit
93b54ce13a
1 changed files with 10 additions and 5 deletions
|
@ -34,13 +34,18 @@
|
|||
|
||||
kc.init = function (initOptions) {
|
||||
kc.authenticated = false;
|
||||
|
||||
if (window.Cordova) {
|
||||
adapter = loadAdapter('cordova');
|
||||
} else {
|
||||
if (initOptions && initOptions.adapter === 'cordova') {
|
||||
adapter = loadAdapter('cordova');
|
||||
} else if (initOptions && initOptions.adapter === 'default') {
|
||||
adapter = loadAdapter();
|
||||
} else {
|
||||
if (window.Cordova) {
|
||||
adapter = loadAdapter('cordova');
|
||||
} else {
|
||||
adapter = loadAdapter();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (initOptions) {
|
||||
if (typeof initOptions.checkLoginIframe !== 'undefined') {
|
||||
loginIframe.enable = initOptions.checkLoginIframe;
|
||||
|
|
Loading…
Reference in a new issue