Skip to content

Add custom domain initialization #247

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion auth-next/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ function makeFacebookCredential(response) {
function makeEmailCredential(email, password) {
// [START auth_make_email_credential]
const { EmailAuthProvider } = require("firebase/auth");

const credential = EmailAuthProvider.credential(email, password);
// [END auth_make_email_credential]
}
Expand Down Expand Up @@ -121,3 +121,17 @@ function signInRedirect(provider) {
signInWithRedirect(auth, provider);
// [END auth_signin_redirect]
}

function initializeWithCustomDomain() {
// [START auth_init_custom_domain]
const { initializeApp } = require("firebase/app");

const firebaseConfig = {
apiKey: "...",
// By default, authDomain is '[YOUR_APP].firebaseapp.com'.
// You may replace it with a custom domain.
authDomain: '[YOUR_CUSTOM_DOMAIN]'
};
const firebaseApp = initializeApp(firebaseConfig);
// [END auth_init_custom_domain]
}
11 changes: 11 additions & 0 deletions auth/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,3 +101,14 @@ function signInRedirect(provider) {
firebase.auth().signInWithRedirect(provider);
// [END auth_signin_redirect]
}

function initializeWithCustomDomain() {
// [START auth_init_custom_domain]
firebase.initializeApp({
apiKey: '...',
// By default, authDomain is '[YOUR_APP].firebaseapp.com'.
// You may replace it with a custom domain.
authDomain: '[YOUR_CUSTOM_DOMAIN]'
});
// [END auth_init_custom_domain]
}
3 changes: 0 additions & 3 deletions auth/oidc.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@
import firebase from "firebase/app";
import "firebase/auth";

// [SNIPPET_REGISTRY disabled]
// [SNIPPETS_SEPARATION enabled]

function oidcProvider() {
// [START auth_oidc_provider_create]
const provider = new firebase.auth.OAuthProvider('oidc.myProvider');
Expand Down
3 changes: 0 additions & 3 deletions auth/saml.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@
import firebase from "firebase/app";
import "firebase/auth";

// [SNIPPET_REGISTRY disabled]
// [SNIPPETS_SEPARATION enabled]

function samlProvider() {
// [START auth_saml_provider_create]
const provider = new firebase.auth.SAMLAuthProvider('saml.myProvider');
Expand Down
17 changes: 17 additions & 0 deletions snippets/auth-next/index/auth_init_custom_domain.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// This snippet file was generated by processing the source file:
// ./auth-next/index.js
//
// To update the snippets in this file, edit the source and then run
// 'npm run snippets'.

// [START auth_init_custom_domain_modular]
import { initializeApp } from "firebase/app";

const firebaseConfig = {
apiKey: "...",
// By default, authDomain is '[YOUR_APP].firebaseapp.com'.
// You may replace it with a custom domain.
authDomain: '[YOUR_CUSTOM_DOMAIN]'
};
const firebaseApp = initializeApp(firebaseConfig);
// [END auth_init_custom_domain_modular]
19 changes: 0 additions & 19 deletions snippets/auth/oidc/auth_oidc_direct_sign_in.js

This file was deleted.

9 changes: 0 additions & 9 deletions snippets/auth/oidc/auth_oidc_provider_create.js

This file was deleted.

18 changes: 0 additions & 18 deletions snippets/auth/oidc/auth_oidc_signin_popup.js

This file was deleted.

11 changes: 0 additions & 11 deletions snippets/auth/oidc/auth_oidc_signin_redirect.js

This file was deleted.

20 changes: 0 additions & 20 deletions snippets/auth/oidc/auth_oidc_signin_redirect_result.js

This file was deleted.

9 changes: 0 additions & 9 deletions snippets/auth/saml/auth_saml_provider_create.js

This file was deleted.

21 changes: 0 additions & 21 deletions snippets/auth/saml/auth_saml_signin_popup.js

This file was deleted.

9 changes: 0 additions & 9 deletions snippets/auth/saml/auth_saml_signin_redirect.js

This file was deleted.

20 changes: 0 additions & 20 deletions snippets/auth/saml/auth_saml_signin_redirect_result.js

This file was deleted.