- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I am trying to authenticate my users with oauth2 for googleplus.
Everything is ok except the part to return to the app.
In the xdk Emulator I get a blank page with a label 'requesting tokens...'
The headers are good and contains the token but it stays there when I expect it to get back to the app.
I tried to debug as well but on my phone instead of getting that 'requesting tokens' screen I get an error:
'The Server refused the connection. (http://localhost:58889/http-services/api-explorer/iodocs/oauth2Callback)
I followed this tutorial:https://software.intel.com/en-us/xdk/article/oauth2-with-intelxdk-cordova-html5 and also tried https://github.com/krisrak/jquery-cordova-oauth2
so when I do that I never see the Hi or the error even ho I got the token back but still not back to the app:
function oauth2_google(){
$.oauth2({
auth_url: 'https://accounts.google.com/o/oauth2/auth',
response_type: 'token',
logout_url: 'https://accounts.google.com/logout',
client_id: 'blablabla',
redirect_uri: 'http://localhost:58889/http-services/api-explorer/iodocs/oauth2Callback',
other_params: {scope:'https://www.googleapis.com/auth/plus.login https://www.googleapis.com/auth/plus.me https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/userinfo.profile'}
}, function(token, response){
alert('Hi'); //makeAPICalls(token);
}, function(error, response){
alert(error);
});
}
- Tags:
- HTML5
- Intel® XDK
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I figured it out,
The issue was that I do need the plugin InAppBrowser on the project.
It was part of the note on the issues on the https://github.com/krisrak/jquery-cordova-oauth2
This was painful to figure out since it is about a project setup instead of a code error.
So the solution is to go to the plugins management of the xdk project and add InAppBrowser and that fix the issue, I hope this will help others
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I've asked one of my colleagues, who is more knowledgable about this feature, to help you out.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I figured it out,
The issue was that I do need the plugin InAppBrowser on the project.
It was part of the note on the issues on the https://github.com/krisrak/jquery-cordova-oauth2
This was painful to figure out since it is about a project setup instead of a code error.
So the solution is to go to the plugins management of the xdk project and add InAppBrowser and that fix the issue, I hope this will help others
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@Kenny,
I noticed the tutorial references Cordova InAppBrowser several times. "Open Oauth2 authorization page in Cordova InAppBrowser".
But I will request the author to make it more explicit about adding the InAppBrowser plugin to the project. Glad you were able to fix it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you for following up!

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page