如何在混合移动应用程序中使用谷歌帐户登录

时间:2016-05-19 22:53:52

标签: login google-login hello.js

我们希望使用混合应用程序中的任何Google帐户登录。我们成功登录Facebook。

从谷歌控制台开发人员我们创建它的Web应用程序。,SHA1指纹也粘贴它,我得到client_id,client_secret。

我收到了这个错误

error screen shot

任何人请告诉我怎么做,任何样品或有用信息请提供

的index.html



<!DOCTYPE HTML>
<html>
    	<head>
    		<meta charset="UTF-8">
    		<title>LoginSN</title>
    		<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=0">
    		<!--
    			<link rel="shortcut icon" href="images/favicon.png">
    			<link rel="apple-touch-icon" href="images/apple-touch-icon.png"> 
    		-->
    		<link href="jqueryMobile/jquery.mobile-1.4.5.css" rel="stylesheet">
    		<link rel="stylesheet" href="css/main.css">
    		<script>window.$ = window.jQuery = WLJQ;</script>
    		<script src="jqueryMobile/jquery.mobile-1.4.5.js"></script>
    		<meta name="manifest" content="./google-services.json" />
        <script>

            // Initate the library
            hello.init({
                google : '349212001841-56rbodaoo5qn3mqp0qdfv80tgqkg651v.apps.googleusercontent.com'
            
            }, {
               redirect_uri : 'http://192.168.0.196:10080/worklightconsole/index.html#/main/LoginSN/applications/LoginSN/'
            });

            function login(network) {
                var hi = hello(network);

                hi.login()
                .then(function(r) {
                    log(r);
                    return hi.api('me');
                })
                .then(log, log);
            }

            function log(r){
                var s = document.createTextNode(JSON.stringify(r, null, "\t"));
                var pre = document.getElementsByTagName('pre')[0];
                pre.insertBefore(s, pre.firstChild);
            }
        </script>
			
			
		</head>
		
    	<body style="display: none;">
    	
    		<div data-role="page" id="loginPage">
    			<div data-role="content" style="padding: 15px">
    				<h1 id="fb-welcome"></h1>
					<label for="text">User Name:</label><input type="text" name="text" id="unL">
					<label for="text">Password:</label><input type="password" name="text" id="pwdL">
					<a href="#dashboardPage" data-role="button" id="buttonLn">LOGIN</a>
					<a href="#registrationPage" data-role="button" id="buttonRe">REGISRASTION</a>
					<a href="#" data-role="button" id="buttonF" onclick="fblogin()">via Facebook Login</a>
									
					 <a href="#" data-role="button" id="login" onclick="login('google')">via Google Login</a>
					
				</div>
    		</div>
    	    		
    		<div data-role="page" id="dashboardPage">
    			<div data-role="content" style="padding: 15px">
    				<a href="#" data-role="button" onclick='Logout();'>LogOut</a>
    			</div>
    		</div>
    		<script src="js/hello.js"></script>
    		<script src="js/initOptions.js"></script>
    		<script src="js/main.js"></script>
    		<script src="js/messages.js"></script>
    		
    	</body>
</html>
&#13;
&#13;
&#13;

0 个答案:

没有答案
相关问题