IBM Worklight - How to use Google authentication in a Hybrid application?

允我心安 提交于 2019-12-02 19:04:23

问题


I am facing difficulties implementing social authentication (using Google, Facebook) in a Worklight app with the Android and iOS environments.

I am trying to use oauth. The following are requirements:

var OAUTHURL    =   'https://accounts.google.com/o/oauth2/auth?';
var VALIDURL    =   'https://www.googleapis.com/oauth2/v1/tokeninfo?access_token=';
var SCOPE       =   'https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email';
var CLIENTID    =   '97612631714.apps.googleusercontent.com';
var REDIRECT    =   ??????
var LOGOUT      =   'http://accounts.google.com/Logout';

After authentication it should be redirected to our app (is located in public domain). For that we have to add a redirect uri to Google API.

I don't know what should be put in REDIRECT.


回答1:


The normal cycle will not work in a Hybrid application because your app does not have a public URL.

Here is one person who documented his experience doing something similar: http://www.itsalif.info/content/oauth-google-api-gapi-phonegap-childbrowser-jquery

Also: https://github.com/andreassolberg/jso/blob/master/README-Phonegap.md

Also a twitter/android example: http://www.mobiledevelopersolutions.com/home/start/twominutetutorials/tmt5p1



来源:https://stackoverflow.com/questions/17943745/ibm-worklight-how-to-use-google-authentication-in-a-hybrid-application

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!