Reactjs 谷歌登录firebase,在React中进行chrome扩展
使用Firebase for Google登录,并使用React创建Chrome扩展。我已经使用Reactjs 谷歌登录firebase,在React中进行chrome扩展,reactjs,firebase,google-signin,Reactjs,Firebase,Google Signin,使用Firebase for Google登录,并使用React创建Chrome扩展。我已经使用GoogleConsole设置了oauth,并且能够使用chrome扩展成功登录 chrome.identity.getAuthToken({ interactive: true }, function (token) { if (chrome.runtime.lastError) { console.log('It was not possible to get a token progra
GoogleConsole
设置了oauth,并且能够使用chrome扩展成功登录
chrome.identity.getAuthToken({ interactive: true }, function (token) {
if (chrome.runtime.lastError) {
console.log('It was not possible to get a token programmatically.');
} else if (chrome.runtime.lastError) {
console.error(chrome.runtime.lastError);
} else if (token) {
// Authorize Firebase with the OAuth Access Token.
var credential = firebase.auth.GoogleAuthProvider.credential(null, token);
firebase.auth().signInWithCredential(credential).catch(function (error) {
// The OAuth token might have been invalidated. Lets' remove it from cache.
if (error.code === 'auth/invalid-credential') {
chrome.identity.removeCachedAuthToken({ token: token }, function () {
signInWithGoogle();
});
}
});
} else {
console.error('The OAuth Token was null');
}
});
现在,我想使用react、redux、webext redux来构造我的代码
在firebase的配置中,包含了apiKey、databaseUrl、storageBucket和authDomain作为chrome-extension://key_name.
在Firebase中的Firebase->auth->SignIn->auth Domains下定义了相同的auth域。
扩展抛出错误Uncaught错误:新iframe-https://chrome-extension/:auth/iframe?apiKey=secretKeys
关于尝试使用谷歌登录
如果需要更多信息,请告诉我。将
chrome.identity
代码从popup.js
转换为background.js
,以便在浏览器中为用户维护单一登录
Popup.js
->background.js
->使用google执行singin
使用webext-redux
,redux
,redux-thunk
,firebase
实现谷歌登录与React