Wir möchten mit jedem Google-Konto anmelden.
Wir haben die client_id, client_secret von Google-Entwicklern erstellt.wie Sie sich mit Google-Konto anmelden
Bitte sagen Sie mir, wie es geht.
Was wir unter
OAuth 2.0-Client-IDs Typ ist Webapplikation
Ich habe diesen Fehler geschrieben, dass Code getan: invalid_client Das OAuth-Client nicht gefunden wurde
bitte irgendeins, warum es kommt
var CLIENT_ID = '349212001841-t1qnhfhp7ail46dh5rn1t6vdc10op93l.apps.googleusercontent.com';
\t \t \t
\t \t \t \t var SCOPES = [ 'https://www.googleapis.com/auth/gmail.readonly' ];
\t \t \t
\t \t \t \t function checkAuth() {
\t \t \t \t \t gapi.auth.authorize({
\t \t \t \t \t \t 'client_id' : CLIENT_ID,
\t \t \t \t \t \t 'scope' : SCOPES.join(' '),
\t \t \t \t \t \t 'immediate' : true
\t \t \t \t \t }, handleAuthResult);
\t \t \t \t }
\t \t \t
\t \t \t \t function handleAuthResult(authResult) {
\t \t \t \t \t var authorizeDiv = document.getElementById('authorize-div');
\t \t \t \t \t if (authResult && !authResult.error) {
\t \t \t \t \t \t authorizeDiv.style.display = 'none';
\t \t \t \t \t \t loadGmailApi();
\t \t \t \t \t } else {
\t \t \t \t \t \t authorizeDiv.style.display = 'inline';
\t \t \t \t \t }
\t \t \t \t }
\t \t \t
\t \t \t \t function handleAuthClick(event) {
\t \t \t \t \t gapi.auth.authorize({
\t \t \t \t \t \t client_id : CLIENT_ID,
\t \t \t \t \t \t scope : SCOPES,
\t \t \t \t \t \t immediate : false
\t \t \t \t \t }, handleAuthResult);
\t \t \t \t \t return false;
\t \t \t \t }
\t \t \t
\t \t \t \t function loadGmailApi() {
\t \t \t \t \t gapi.client.load('gmail', 'v1', listLabels);
\t \t \t \t }
\t \t \t
\t \t \t \t function listLabels() {
\t \t \t \t \t var request = gapi.client.gmail.users.labels.list({
\t \t \t \t \t \t 'userId' : 'me'
\t \t \t \t \t });
\t \t \t
\t \t \t \t \t request.execute(function(resp) {
\t \t \t \t \t \t var labels = resp.labels;
\t \t \t \t \t \t appendPre('Labels:');
\t \t \t
\t \t \t \t \t \t if (labels && labels.length > 0) {
\t \t \t \t \t \t \t for (i = 0; i < labels.length; i++) {
\t \t \t \t \t \t \t \t var label = labels[i];
\t \t \t \t \t \t \t \t appendPre(label.name)
\t \t \t \t \t \t \t }
\t \t \t \t \t \t } else {
\t \t \t \t \t \t \t appendPre('No Labels found.');
\t \t \t \t \t \t }
\t \t \t \t \t });
\t \t \t \t }
\t \t \t
\t \t \t function appendPre(message) {
\t \t \t \t \t var pre = document.getElementById('output');
\t \t \t \t \t var textContent = document.createTextNode(message + '\n');
\t \t \t \t \t pre.appendChild(textContent);
\t \t \t \t }
<!DOCTYPE HTML>
<html>
\t <head>
\t \t <meta charset="UTF-8">
\t \t <title>LoginSN</title>
\t \t <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=0">
\t \t <!--
\t \t \t <link rel="shortcut icon" href="images/favicon.png">
\t \t \t <link rel="apple-touch-icon" href="images/apple-touch-icon.png">
\t \t -->
\t \t <link href="jqueryMobile/jquery.mobile-1.4.5.css" rel="stylesheet">
\t \t <link rel="stylesheet" href="css/main.css">
\t \t <script>window.$ = window.jQuery = WLJQ;</script>
\t \t <script src="jqueryMobile/jquery.mobile-1.4.5.js"></script>
\t \t <script src="https://apis.google.com/js/client.js?onload=checkAuth"/></script>
\t \t
</head>
\t \t
\t <body style="display: none;">
\t
\t \t <div data-role="page" id="loginPage">
\t \t \t <div data-role="content" style="padding: 15px">
\t \t \t \t <h1 id="fb-welcome"></h1>
\t \t \t \t \t <label for="text">User Name:</label><input type="text" name="text" id="unL">
\t \t \t \t \t <label for="text">Password:</label><input type="password" name="text" id="pwdL">
\t \t \t \t \t <a href="#dashboardPage" data-role="button" id="buttonLn">LOGIN</a>
\t \t \t \t \t <a href="#registrationPage" data-role="button" id="buttonRe">REGISRASTION</a>
\t \t \t \t \t <a href="#" data-role="button" id="buttonF" onclick="fblogin()">via Facebook Login</a>
\t \t \t \t \t <!-- <a href="#" data-role="button" id="login" class="g-signin2" data-onsuccess="onSignIn">via Google Login</a> -->
\t \t \t \t \t <!-- <a href="#" data-role="button" id="login" onclick="callGoogle()">via Google Login</a> -->
\t \t \t \t \t
\t \t \t \t \t <!-- <a href="#" data-role="button" id="login" onclick="login('google')">via Google Login</a> -->
\t \t \t \t \t <div id="authorize-div" >
\t \t \t \t \t <span>Authorize access to Gmail API</span>
\t \t \t \t \t <a href="#" data-role="button" id="authorize-button" onclick="handleAuthClick(event)">via Google Login</a>
\t \t \t \t \t </div>
\t \t \t \t </div>
\t \t </div>
<div data-role="page" id="dashboardPage">
\t \t \t <div data-role="content" style="padding: 15px">
\t \t \t \t <a href="#" data-role="button" onclick='Logout();'>LogOut</a>
\t \t \t </div>
\t \t </div>
\t \t
\t \t <script src="js/initOptions.js"></script>
\t \t <script src="js/main.js"></script>
\t \t <script src="js/messages.js"></script>
\t \t
\t </body>
</html>
Ich bin nicht in der Lage, Google Login Pop in meiner Anwendung zu sehen –
Sieht hier für ähnliche Frage: http://StackOverflow.com/Questions/17943745/ibm-Worklight-how-to-use-google-authentication-in- A-Hybrid-Anwendung –
Idan ich änderte die Frage und den Code finden Sie es bitte. Ich habe Fehler, warum es kommt, lass es mich wissen –