diff --git a/auth-next/facebook.js b/auth-next/facebook.js index 4b61f4be..90414d7e 100644 --- a/auth-next/facebook.js +++ b/auth-next/facebook.js @@ -163,3 +163,12 @@ function authWithCredential(credential) { }); // [END auth_facebook_signin_credential] } + +function facebookProviderCredential(accessToken) { + // [START auth_facebook_provider_credential] + const { FacebookAuthProvider } = require("firebase/auth"); + + const credential = FacebookAuthProvider.credential(accessToken); + // [END auth_facebook_provider_credential] +} + diff --git a/auth-next/google-signin.js b/auth-next/google-signin.js index 78b79a61..1e1cee59 100644 --- a/auth-next/google-signin.js +++ b/auth-next/google-signin.js @@ -157,4 +157,13 @@ function isUserEqual_wrapper() { // [END auth_google_checksameuser] } +function googleProviderCredential(idToken) { + // [START auth_google_provider_credential] + const { GoogleAuthProvider } = require("firebase/auth"); + + const credential = GoogleAuthProvider.credential(idToken); + // [END auth_google_provider_credential] +} + + diff --git a/auth-next/twitter.js b/auth-next/twitter.js index 8024bbe5..57416b03 100644 --- a/auth-next/twitter.js +++ b/auth-next/twitter.js @@ -73,3 +73,10 @@ function twitterSignInRedirectResult() { // [END auth_twitter_signin_redirect_result] } +function twitterProviderCredential(accessToken, secret) { + // [START auth_twitter_provider_credential] + const { TwitterAuthProvider } = require("firebase/auth"); + + const credential = TwitterAuthProvider.credential(accessToken, secret); + // [END auth_twitter_provider_credential] +} \ No newline at end of file diff --git a/auth/facebook.js b/auth/facebook.js index 3e5c5b14..4259960d 100644 --- a/auth/facebook.js +++ b/auth/facebook.js @@ -151,3 +151,9 @@ function authWithCredential(credential) { }); // [END auth_facebook_signin_credential] } + +function facebookProviderCredential(accessToken) { + // [START auth_facebook_provider_credential] + var credential = firebase.auth.FacebookAuthProvider.credential(accessToken); + // [END auth_facebook_provider_credential] +} diff --git a/auth/google-signin.js b/auth/google-signin.js index 908a32e1..fcc32dc8 100644 --- a/auth/google-signin.js +++ b/auth/google-signin.js @@ -142,3 +142,9 @@ function isUserEqual(googleUser, firebaseUser) { return false; } // [END auth_google_checksameuser] + +function googleProviderCredential(idToken) { + // [START auth_google_provider_credential] + var credential = firebase.auth.GoogleAuthProvider.credential(idToken); + // [END auth_google_provider_credential] +} diff --git a/auth/initialization.txt b/auth/initialization.txt new file mode 100644 index 00000000..bccb0571 --- /dev/null +++ b/auth/initialization.txt @@ -0,0 +1,9 @@ + + \ No newline at end of file diff --git a/auth/multi-tenancy.js b/auth/multi-tenancy.js index 8afc1a5c..8b31e145 100644 --- a/auth/multi-tenancy.js +++ b/auth/multi-tenancy.js @@ -23,7 +23,7 @@ function switchTenantSingleAuth() { // [END multitenant_switch_tenant] } -function switchTenantMultiAuthInstance(config) { +function switchTenantMultiAuth(config) { // [START multitenant_switch_tenant_multiinstance] // Multiple Auth instances firebase.initializeApp(config, 'app1_for_tenantId1'); diff --git a/auth/twitter.js b/auth/twitter.js index b1ca2581..a78370b7 100644 --- a/auth/twitter.js +++ b/auth/twitter.js @@ -76,3 +76,9 @@ function twitterSignInRedirectResult() { }); // [END auth_twitter_signin_redirect_result] } + +function twitterProviderCredential(accessToken, secret) { + // [START auth_twitter_provider_credential] + var credential = firebase.auth.TwitterAuthProvider.credential(accessToken, secret); + // [END auth_twitter_provider_credential] +} \ No newline at end of file diff --git a/snippets/auth-next/facebook/auth_facebook_provider_credential.js b/snippets/auth-next/facebook/auth_facebook_provider_credential.js new file mode 100644 index 00000000..b7bbca25 --- /dev/null +++ b/snippets/auth-next/facebook/auth_facebook_provider_credential.js @@ -0,0 +1,11 @@ +// This snippet file was generated by processing the source file: +// ./auth-next/facebook.js +// +// To update the snippets in this file, edit the source and then run +// 'npm run snippets'. + +// [START auth_facebook_provider_credential_modular] +import { FacebookAuthProvider } from "firebase/auth"; + +const credential = FacebookAuthProvider.credential(accessToken); +// [END auth_facebook_provider_credential_modular] \ No newline at end of file diff --git a/snippets/auth-next/google-signin/auth_google_provider_credential.js b/snippets/auth-next/google-signin/auth_google_provider_credential.js new file mode 100644 index 00000000..924aa167 --- /dev/null +++ b/snippets/auth-next/google-signin/auth_google_provider_credential.js @@ -0,0 +1,11 @@ +// This snippet file was generated by processing the source file: +// ./auth-next/google-signin.js +// +// To update the snippets in this file, edit the source and then run +// 'npm run snippets'. + +// [START auth_google_provider_credential_modular] +import { GoogleAuthProvider } from "firebase/auth"; + +const credential = GoogleAuthProvider.credential(idToken); +// [END auth_google_provider_credential_modular] \ No newline at end of file diff --git a/snippets/auth-next/twitter/auth_twitter_provider_credential.js b/snippets/auth-next/twitter/auth_twitter_provider_credential.js new file mode 100644 index 00000000..e25b369c --- /dev/null +++ b/snippets/auth-next/twitter/auth_twitter_provider_credential.js @@ -0,0 +1,11 @@ +// This snippet file was generated by processing the source file: +// ./auth-next/twitter.js +// +// To update the snippets in this file, edit the source and then run +// 'npm run snippets'. + +// [START auth_twitter_provider_credential_modular] +import { TwitterAuthProvider } from "firebase/auth"; + +const credential = TwitterAuthProvider.credential(accessToken, secret); +// [END auth_twitter_provider_credential_modular] \ No newline at end of file