Open deliverymanager opened 7 years ago
+1
Is there some solution about this?
waiting for solution or temporary work around for this. stuck with this have a pending release
possible fix by changing this line from _blank
to _system
https://github.com/sahat/satellizer/blob/master/src/popup.ts#L49
...haven't tried it yet.
gigmaps solution did not work.
I didn't find solution that I liked, however, there is a way to set the user agent string in config.xml by using
OverrideUserAgent key and some arbitrary value which bypasses Google's detection, and will successfully be able to log in.
The problems with this approach though are:
1) confusing documentation: https://cordova.apache.org/docs/en/latest/config_ref/index.html OverrideUserAgent says it's only supported on Android, however it worked on iOS for me as well.
2) ionic.bundle.js has dependency on the user agent, so it can't be anything random. If you put user agent as "Mozilla Firefox", you'll bypass google, but then ionic.Platform.isIOS() etc stop working.
at the end of the day, I wanted stable and clear solution, so I ended up not working around this and decided to rewrite it using native stuff.
small edit:
I found a better solution, I still ended up using native solution, however it integrated quite well with Satellizer so I didn't need to do anything hackish IMO. The way it works is that I inject SatellizerPopup, and check if it's trying to open google authentication modal, if yes, I'll show the native popup instead.
This is just part of angularJS run(), note that you probably have to modify it quite a bit (the logic stays the same), but you probably don't use ES6 the way I do.
export default function ($q, SatellizerPopup, GOOGLE_WEBCLIENT_ID) {
const originalPopupOpenFunc = SatellizerPopup.open;
SatellizerPopup.open = function (url, name, popupOptions, redirectUri, dontPoll) {
if (name === 'google') {
const deferred = $q.defer();
const googlePlusSettings = {
webClientId: GOOGLE_WEBCLIENT_ID, // use whatever variable you have
offline: true
};
const nativeLoginSuccess = (response) => {
deferred.resolve({
clientId: googlePlusSettings.webClientId,
code: response.serverAuthCode,
redirectUri
});
};
const loginNatively = () => window.plugins.googleplus.login(googlePlusSettings, nativeLoginSuccess, deferred.reject);
window.plugins.googleplus.logout(loginNatively, loginNatively);
return deferred.promise;
}
return originalPopupOpenFunc.apply(this, arguments);
};
}
@ChrisEelmaa: how can I use your solution with ionic 1? I have difficulty to integrate your solution in my project which is written in angularJs an ionic 1.
So what is the final conclusion for this thread?
Yesterday I googled and found a way finally. Here is my process
Steps:
installed the chrome custom tabs Cordova plugin.
Created by own URL and opening in a custom tab.
redirecting the intermediate code to my server URL.
In the server I'm redirecting to app by using the custom URL scheme (in my case elivio://registration/{code})
In the app im handling the deeplink and getting the token and then again sending to server for getting the original JWT login token.
The above process is checked only for Android
Indirectly I'm not using this plugin only when the provider is Google.
I have recently created a new google plus project/key and when I tried to make a login from my Ionic/iOS app, I got the following error: disallowed_useragent The explaination of it is below. https://developers.googleblog.com/2016/08/modernizing-oauth-interactions-in-native-apps.html
That probably means that we can no longer use the inAppBrowser cordova plugin? How will satellizer work from now on?