Skip to content

Commit 20d5d98

Browse files
authored
add initialization with custom domain code (#247)
remove wrong tags (supposed to be for auth-next)
1 parent 5062c76 commit 20d5d98

14 files changed

+43
-143
lines changed

auth-next/index.js

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ function makeFacebookCredential(response) {
2626
function makeEmailCredential(email, password) {
2727
// [START auth_make_email_credential]
2828
const { EmailAuthProvider } = require("firebase/auth");
29-
29+
3030
const credential = EmailAuthProvider.credential(email, password);
3131
// [END auth_make_email_credential]
3232
}
@@ -121,3 +121,17 @@ function signInRedirect(provider) {
121121
signInWithRedirect(auth, provider);
122122
// [END auth_signin_redirect]
123123
}
124+
125+
function initializeWithCustomDomain() {
126+
// [START auth_init_custom_domain]
127+
const { initializeApp } = require("firebase/app");
128+
129+
const firebaseConfig = {
130+
apiKey: "...",
131+
// By default, authDomain is '[YOUR_APP].firebaseapp.com'.
132+
// You may replace it with a custom domain.
133+
authDomain: '[YOUR_CUSTOM_DOMAIN]'
134+
};
135+
const firebaseApp = initializeApp(firebaseConfig);
136+
// [END auth_init_custom_domain]
137+
}

auth/index.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,3 +101,14 @@ function signInRedirect(provider) {
101101
firebase.auth().signInWithRedirect(provider);
102102
// [END auth_signin_redirect]
103103
}
104+
105+
function initializeWithCustomDomain() {
106+
// [START auth_init_custom_domain]
107+
firebase.initializeApp({
108+
apiKey: '...',
109+
// By default, authDomain is '[YOUR_APP].firebaseapp.com'.
110+
// You may replace it with a custom domain.
111+
authDomain: '[YOUR_CUSTOM_DOMAIN]'
112+
});
113+
// [END auth_init_custom_domain]
114+
}

auth/oidc.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@
44
import firebase from "firebase/app";
55
import "firebase/auth";
66

7-
// [SNIPPET_REGISTRY disabled]
8-
// [SNIPPETS_SEPARATION enabled]
9-
107
function oidcProvider() {
118
// [START auth_oidc_provider_create]
129
const provider = new firebase.auth.OAuthProvider('oidc.myProvider');

auth/saml.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@
44
import firebase from "firebase/app";
55
import "firebase/auth";
66

7-
// [SNIPPET_REGISTRY disabled]
8-
// [SNIPPETS_SEPARATION enabled]
9-
107
function samlProvider() {
118
// [START auth_saml_provider_create]
129
const provider = new firebase.auth.SAMLAuthProvider('saml.myProvider');
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// This snippet file was generated by processing the source file:
2+
// ./auth-next/index.js
3+
//
4+
// To update the snippets in this file, edit the source and then run
5+
// 'npm run snippets'.
6+
7+
// [START auth_init_custom_domain_modular]
8+
import { initializeApp } from "firebase/app";
9+
10+
const firebaseConfig = {
11+
apiKey: "...",
12+
// By default, authDomain is '[YOUR_APP].firebaseapp.com'.
13+
// You may replace it with a custom domain.
14+
authDomain: '[YOUR_CUSTOM_DOMAIN]'
15+
};
16+
const firebaseApp = initializeApp(firebaseConfig);
17+
// [END auth_init_custom_domain_modular]

snippets/auth/oidc/auth_oidc_direct_sign_in.js

Lines changed: 0 additions & 19 deletions
This file was deleted.

snippets/auth/oidc/auth_oidc_provider_create.js

Lines changed: 0 additions & 9 deletions
This file was deleted.

snippets/auth/oidc/auth_oidc_signin_popup.js

Lines changed: 0 additions & 18 deletions
This file was deleted.

snippets/auth/oidc/auth_oidc_signin_redirect.js

Lines changed: 0 additions & 11 deletions
This file was deleted.

snippets/auth/oidc/auth_oidc_signin_redirect_result.js

Lines changed: 0 additions & 20 deletions
This file was deleted.

snippets/auth/saml/auth_saml_provider_create.js

Lines changed: 0 additions & 9 deletions
This file was deleted.

snippets/auth/saml/auth_saml_signin_popup.js

Lines changed: 0 additions & 21 deletions
This file was deleted.

snippets/auth/saml/auth_saml_signin_redirect.js

Lines changed: 0 additions & 9 deletions
This file was deleted.

snippets/auth/saml/auth_saml_signin_redirect_result.js

Lines changed: 0 additions & 20 deletions
This file was deleted.

0 commit comments

Comments
 (0)