Skip to content

Commit

Permalink
Update AuthUI initialization to take entire app check provider
Browse files Browse the repository at this point in the history
  • Loading branch information
SolomonLake committed May 14, 2024
1 parent 88d3a4c commit 82fe90c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
4 changes: 2 additions & 2 deletions firebase-externs/firebase-app-check-externs.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ firebase.appCheck = function (app) {};
firebase.appCheck.AppCheck = function () {};

/**
* @param {firebase.appCheck.ReCaptchaEnterpriseProvider} provider
* @param {firebase.appCheck.Provider} provider
* @param {boolean} refresh
*/
firebase.appCheck.AppCheck.prototype.activate = function (provider, refresh) {};

/**
* @constructor
*/
firebase.appCheck.ReCaptchaEnterpriseProvider = function (appCheckToken) {};
firebase.appCheck.Provider = function (appCheckToken) {};
10 changes: 4 additions & 6 deletions javascript/widgets/authui.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,10 @@ goog.requireType('firebaseui.auth.ui.page.Base');
/**
* @param {!firebase.auth.Auth} auth The Firebase Auth instance.
* @param {string=} opt_appId The optional app id.
* @param {string=} appCheckToken The optional app id.
* @param {firebase.appCheck.Provider=} appCheckProvider The optional app check provider.
* @constructor @struct
*/
firebaseui.auth.AuthUI = function(auth, opt_appId, appCheckToken) {
firebaseui.auth.AuthUI = function(auth, opt_appId, appCheckProvider) {
/** @private {boolean} Whether the current instance is deleted. */
this.deleted_ = false;
// Check if an instance with the same key exists. If so, throw an error,
Expand All @@ -128,12 +128,10 @@ firebaseui.auth.AuthUI = function(auth, opt_appId, appCheckToken) {
var tempApp = firebase.initializeApp({
...auth['app']['options']
}, auth['app']['name'] + firebaseui.auth.AuthUI.TEMP_APP_NAME_SUFFIX_);
if (appCheckToken) {
if (appCheckProvider) {
const appCheck = firebase.appCheck(tempApp);
appCheck.activate(
new firebase.appCheck.ReCaptchaEnterpriseProvider(
appCheckToken
),
appCheckProvider,
true // Set to true to allow auto-refresh.
);
}
Expand Down

0 comments on commit 82fe90c

Please sign in to comment.