2016-05-23 5 views
0

私たちはどのGoogleアカウントでもワークライトハイブリッドモバイルサンプルアプリケーションにログインしようとしています。画面の下解決方法問題のあるクライアント、OAuthクライアントが見つかりませんでした

は我々だけで、ページの読み込みのOAuth 2.0クライアントID

<!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 <meta name="manifest" content="./google-services.json" /> 
 
     
 
\t \t \t <script type="text/javascript"> 
 
\t \t \t 
 
\t \t \t \t var CLIENT_ID = '<349212001841-2n2vc099on8m0qkms753bdbr60ecnf5o.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 } 
 
\t \t \t </script> 
 

 
</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> 
 
    \t  \t \t 
 
    \t \t <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 <script src="js/hello.js"></script> 
 
    \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>

Steps for we creating the google gmail API and creating OAuth 2.0 client IDs

をエラーログにエラーはありませんが、GoogleのGmailのAPIを作成し、作成するための手順を撃ちましたエラーはここで引用されています。 私たちは、この画面のようなエラーはエラー401が無効な認証ヘッダーを持っていることを意味し

enter image description here

答えて

0

を撮影しました。使用しているアクセストークンの有効期限が切れているか無効です。長寿命リフレッシュトークンを使用してアクセストークンをリフレッシュしてみてください。これが失敗した場合は、OAuth flowまでご連絡ください。おそらく、Developers Consoleでclient idを再作成する必要があります。 Google+ APIを有効にしてください。

質問ので、これらの関連を調べる:あなたが同意画面でのサポートのメールアドレスを設定する前に、OAuthの資格情報を作成した場合、あなたが常にこれを取得することが表示されます

  • Error: invalid_client with Google Apps API OAuth2

    エラーが発生しました。私は、サポート電子メールを設定し、資格情報ページで必要なすべてのOAuth IDを再作成することでこれを解決しました。

  • invalid_client in google oauth2

    セット/お使いの製品名を変更し、私はプロジェクト名と同じよう製品名を作成するまで、私はこの問題を持っていました。製品名は、プロジェクトのGoogle Developers Consoleの[Consent screen]セクションで設定できます。左側のナビゲーションでAPI & authを探して、Consent screenを選択します。また、商品名の上にあるボックスにメールアドレスを設定する必要があります。

+0

abielita私は質問を変更してください。エラーは解決されません。私はあなたが今まで言ったことに従います。 –

関連する問題