Я работаю над своим проектом, используя inappbrowser ionic, чтобы посмотреть на мой webapp. Я следую инструкции (http://sourcefreeze.com/cordova-inappbrowser-plugin-example-using-ionic-framework/), и у меня приложение работает на моем устройстве (iphone 6s, ios 10.1.1). Мой веб-приложение с помощью Google API и здесь службаInappbrowser ionic не загружает 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');
});
}
}
А вот часть моего 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
Моих 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"
Я могу испытать в этом случае я использовал oauth2 v3, который бы сделал некоторые проблемы в Inappbrowser, im not su число рейнольдса Любая идея, что не так с моим приложением? Любая помощь не была бы оценена :)
google больше не разрешает oauth от inappbrowser –
любую ссылку, чтобы доказать это, приятель? –
yes, https://developers.googleblog.com/2016/08/modernizing-oauth-interactions-in-native-apps.html –