Googleログインを統合する必要があるプラグインを作成しました。検索しましたクロム拡張機能でgoogleを使用してログインを作成する方法
chrome.identity
Googleアカウントを使用してユーザーを認証してもうまくいきません。
だから
VARマニフェスト= chrome.runtime.getManifest()以下のコードを使用して溶液に出くわしました。
私はurl変数からv2
を削除する場合、私はその成功とリターンコードを
v2
を追加する場合、それは常に
id_token
と順番にエラーが発生しますが、これでは
var clientId = encodeURIComponent(manifest.oauth2.client_id);
var scopes = encodeURIComponent(manifest.oauth2.scopes.join(' '));
var redirectUri = encodeURIComponent('urn:ietf:wg:oauth:2.0:oob:auto');
var url = 'https://accounts.google.com/o/oauth2/v2/auth' +
'?client_id=' + clientId +
'&response_type=code' +
'&redirect_uri=' + redirectUri +
'&scope=' + scopes;
var RESULT_PREFIX = ['Success', 'Denied', 'Error'];
chrome.tabs.create({'url': 'about:blank'}, function(authenticationTab) {
chrome.tabs.onUpdated.addListener(function googleAuthorizationHook(tabId, changeInfo, tab) {
if (tabId === authenticationTab.id) {
var titleParts = tab.title.split(' ', 2);
var result = titleParts[0];
if (titleParts.length == 2 && RESULT_PREFIX.indexOf(result) >= 0) {
chrome.tabs.onUpdated.removeListener(googleAuthorizationHook);
chrome.tabs.remove(tabId);
var response = titleParts[1];
switch (result) {
case 'Success':
// Example: id_token=<YOUR_BELOVED_ID_TOKEN>&authuser=0&hd=<SOME.DOMAIN.PL>&session_state=<SESSION_SATE>&prompt=<PROMPT>
console.log("suc:"+response);
break;
case 'Denied':
// Example: error_subtype=access_denied&error=immediate_failed
console.log("denied:"+response);
break;
case 'Error':
// Example: 400 (OAuth2 Error)!!1
console.log("error:"+response);
break;
}
}
}
});
chrome.tabs.update(authenticationTab.id, {'url': url});
});
。
は、だから今、私は今client_id and client_secret
を使用してPOSTリクエストを作成することを言ったのGoogleドキュメントを読んで、私はアプリは、私が何をすべき今client_secret
を持っていないGoogleのコンソール上の資格を作成クロム?私が逃した、またはここで間違っているものは何ですか?また、クロムエクステンションScreencastify
のGoogleログインを使用しています。
誰でもどのように説明できますか?