Je travaille sur mon projet en utilisant inappbrowser ionic pour faire une vue de ma webapp. Je suis l'instruction (http://sourcefreeze.com/cordova-inappbrowser-plugin-example-using-ionic-framework/) et j'ai l'application exécutée sur mon appareil (iphone 6s, ios 10.1.1). Mon application Web en utilisant google api et voici le serviceInappbrowser ionique ne charge pas Oauth
function GoogleDriveAuthentication($rootScope){
this.authenticate = function(){
gapi.load('client:auth2',authorize);
}
function authorize(){
gapi.client.setApiKey($rootScope.API_KEY);
gapi.auth2.init({
client_id: $rootScope.CLIENT_ID,
scope: $rootScope.SCOPES
}).then(function(authResult){
var auth2 = gapi.auth2.getAuthInstance();
var user = auth2.currentUser.get();
if (user.isSignedIn()) {
afterSignInSuccess();
} else {
auth2.signIn().then(afterSignInSuccess,afterSignInFailed);
}
});
}
function afterSignInFailed(respond){
console.log(respond);
}
function afterSignInSuccess(respond){
console.log('authenticated successfully');
var auth2 = gapi.auth2.getAuthInstance();
var user = auth2.currentUser.get();
var authResponse = user.getAuthResponse();
$rootScope.accessToken = user.getAuthResponse().access_token;
$rootScope.authenticated = true;
gapi.client.load('drive', 'v3',function(){
$rootScope.$broadcast('authenticated');
});
}
}
Et voici une partie de mes app.js
app.run(function($rootScope,$location,$route, GoogleDriveAuthentication,DTOptionsBuilder){
$rootScope.$on('$routeChangeSuccess', function(){
document.title = "SuperProject - " + $route.current.title;
$('#superSearch').typeahead('val', '');
if ($location.path() != "/register" && $location.path() != "/forgot"){
if (!$rootScope.loggedin){
console.log($rootScope.loggedin);
$location.path("/login");
}
else if (!$rootScope.authenticated){
console.log('authenticate');
GooghleDriveAuthentication.authenticate();
}
}
if ($location.path != '/home') {
$('#superSearch').blur();
}
})
And when I run it in Inappbrowser, it's stuck like this
Mes-plugins: cordova
cordova-plugin-console 1.0.4 "Console"
cordova-plugin-device 1.1.3 "Device"
cordova-plugin-inappbrowser 1.5.0 "InAppBrowser"
cordova-plugin-splashscreen 4.0.0 "Splashscreen"
cordova-plugin-statusbar 2.2.0 "StatusBar"
cordova-plugin-whitelist 1.3.0 "Whitelist"
ionic-plugin-keyboard 2.2.1 "Keyboard"
Je peux rencontrer dans ce cas, j'ai utilisé oauth2 v3 qui ferait quelques problèmes dans Inappbrowser, je ne suis pas su ré. Une idée de ce qui ne va pas avec mon application? Toute aide serait appréciée :)
google n'autorise plus d'accès depuis l'interface utilisateur –
un lien pour le prouver, mate? –
oui, https://developers.googleblog.com/2016/08/modernizing-oauth-interactions-in-native-apps.html –