【发布时间】:2017-01-02 13:39:14
【问题描述】:
我正在使用 Ionic 和 cordova 构建一个 Android 应用程序。 我有一个 wordpress 网站 - 安装了一些访问功能的 oauth2 插件在哪里。我想先获取代码,然后再发送帖子以检索令牌。我在网络浏览器中对其进行了测试,效果很好:
location.replace('https://xxx/oauth/authorize?response_type=code&client_id=xxx&redirect_uri=http://192.168.0.129:8100/');
客户端登录到我的网站并将其重定向到我的应用程序后,我正在获取代码,该应用程序位于 ip 192.168.0.129:8100 上,代码在 url 中 - 它不会。但在我使用的android中:
var options = {
clearcache: 'yes',
toolbar: 'no'
};
$cordovaInAppBrowser.open('https://xxx/oauth/authorize?response_type=code&client_id=xxx&redirect_uri=http://192.168.0.129:8100/', '_blank' , options)
.then(function(event) {
}).then(function(){
});
一切正常,但重定向无效 - 它无法再次加载我的应用程序。我进行了一些研究,大多数人将http://localhost/ 或http://localhost/callback 放置到返回到Android 应用程序,但它对我也不起作用。重定向 URL 比什么?如何返回应用程序? 当然 'xxx' 只是举例;)
【问题讨论】:
标签: android angularjs cordova ionic-framework oauth2