と呼ばれていませんでした。私を怒らせるので、3つの無駄な「ドロップイン」認証ソリューションを適用してここに投稿します。うまくいけば、誰もが私が行方不明になっていることにどのような光を発することができます。Chrome拡張機能のFirebase UI:signInSuccessは決して
基本的に私は、ダッシュボードにfaribesアプリをセットアップして、chrome拡張機能に正常にinited farebaseを設定しました。 firebasUIを電子メール/パスワード認証のためにドロップすると、正常に動作しているように見えます。電子メールが存在するかどうかを確認し、それぞれのフローを表示します。サインアップの場合、フローが完了すると、Firebaseデータベースにユーザを作成します。
signInSuccessは、サインインまたはサインアップフローのどちらでも呼び出されないという問題があります。 はまたfirebase.auth().onAuthStateChanged(...)
常にnull
ユーザー
私はプレーンを使用する場合signInWithEmailAndPassword()/createUserWithEmailAndPassword()
すべてが正常に動作してonAuthStateChanged()
が正しいユーザーを返しますが返されます。
は、私はChromeの拡張機能で使用しているコードです:
credentials.js(ポップアップスクリプト):
//init firebase
var config = {
apiKey: "<my_key>",
authDomain: "<my_domain>",
databaseURL: "<my_dburl>",
projectId: "<my_projectid>",
storageBucket: "<my_storagebucket>",
messagingSenderId: "<my_id>"
};
firebase.initializeApp(config);
//ui config for firebaseUI
var uiConfig = {
signInSuccessUrl: 'http://google.com',
credentialHelper: firebaseui.auth.CredentialHelper.NONE,
callbacks: {
signInSuccess: function(currentUser, credential, redirectUrl) {
console.log('sign in success');
console.log(currentUser);
// alert(currentUser)
return false;
},
uiShown: function() {
console.log("uiShow");
}
},
signInFlow: 'popup',
signInOptions: [{
provider: firebase.auth.EmailAuthProvider.PROVIDER_ID,
requireDisplayName: false
}]
};
//launch the firebaseUI flow
var ui = new firebaseui.auth.AuthUI(firebase.auth());
ui.start('#firebaseui-auth-container', uiConfig);
credentials.html(ポップアップHTML):
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Sample FirebaseUI App</title>
<script src="https://www.gstatic.com/firebasejs/4.6.2/firebase.js"></script>
<script src="https://cdn.firebase.com/libs/firebaseui/2.5.1/firebaseui.js"></script>
<link type="text/css" rel="stylesheet" href="https://cdn.firebase.com/libs/firebaseui/2.5.1/firebaseui.css" />
<script src="credentials.js"></script>
</head>
<body>
<!-- The surrounding HTML is left untouched by FirebaseUI.
Your app may use that space for branding, controls and other customizations.-->
<h1>Welcome to My Awesome App</h1>
<div id="firebaseui-auth-container"></div>
</body>
</html>
マニフェスト:
{
"manifest_version": 2,
"name": "Some Name",
"description": "Some description",
"version": "0.1",
"icons": {
"128": "icon.png"
},
"browser_action": {
"default_icon": "icon.png",
"default_popup": "credentials.html"
},
"background": {
"page": "background.html"
},
"permissions": [
"identity",
"https://*/*",
"activeTab",
"background"
],
"content_security_policy":"script-src 'self' https://www.gstatic.com https://apis.google.com https://www.googleapis.com https://securetoken.googleapis.com https://*.firebaseio.com https://cdn.firebase.com https://www.google.com; object-src 'self'",
"oauth2": {
"client_id": "<numbers.letters.apps.googleusercontent.com>",
"scopes": [
"https://www.googleapis.com/auth/userinfo.email",
"https://www.googleapis.com/auth/userinfo.profile"
]
},
"key":"<my_chrome_extension_key>"
}
注:私はどんなclient_id
を置くことができ、それはどんな違いがありません(firebaseUI
が機能せず、とにかくfirebase
作品)
私はthis github手順に従っていましたから、コードベースを使用のように思えますレポ
すべての入力を高く評価します。