Skip to content

Commit c356483

Browse files
authored
Merge branch 'firebase:master' into gregfenton-patch-issue-221
2 parents 4c839e5 + 2414b55 commit c356483

File tree

133 files changed

+2302
-159
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

133 files changed

+2302
-159
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
strategy:
1414
matrix:
1515
node-version:
16-
- 12.x
16+
- 14.x
1717
steps:
1818
- uses: actions/checkout@v1
1919
- uses: actions/setup-node@v1

analytics-next/index.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,7 @@ function logEventParams() {
2727
const analytics = getAnalytics();
2828
logEvent(analytics, 'select_content', {
2929
content_type: 'image',
30-
content_id: 'P12453',
31-
items: [{ name: 'Kittens' }]
30+
content_id: 'P12453'
3231
});
3332
// [END analytics_log_event_params]
3433
}

analytics-next/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@
66
},
77
"license": "Apache-2.0",
88
"dependencies": {
9-
"firebase": "^9.0.0-beta.8"
9+
"firebase": "^9.12.1"
1010
}
1111
}

analytics/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@
66
},
77
"license": "Apache-2.0",
88
"dependencies": {
9-
"firebase": "^8.9.1"
9+
"firebase": "^8.10.0"
1010
}
1111
}

appcheck-next/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@
66
},
77
"license": "Apache-2.0",
88
"dependencies": {
9-
"firebase": "^9.0.0-beta.8"
9+
"firebase": "^9.12.1"
1010
}
1111
}

appcheck/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@
66
},
77
"license": "Apache-2.0",
88
"dependencies": {
9-
"firebase": "^8.9.1"
9+
"firebase": "^8.10.0"
1010
}
1111
}

auth-next/apple.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,15 @@ function appleSignInPopup(provider) {
3838
const accessToken = credential.accessToken;
3939
const idToken = credential.idToken;
4040

41+
// IdP data available using getAdditionalUserInfo(result)
4142
// ...
4243
})
4344
.catch((error) => {
4445
// Handle Errors here.
4546
const errorCode = error.code;
4647
const errorMessage = error.message;
4748
// The email of the user's account used.
48-
const email = error.email;
49+
const email = error.customData.email;
4950
// The credential that was used.
5051
const credential = OAuthProvider.credentialFromError(error);
5152

@@ -85,7 +86,7 @@ function appleSignInRedirectResult() {
8586
const errorCode = error.code;
8687
const errorMessage = error.message;
8788
// The email of the user's account used.
88-
const email = error.email;
89+
const email = error.customData.email;
8990
// The credential that was used.
9091
const credential = OAuthProvider.credentialFromError(error);
9192

@@ -123,7 +124,7 @@ function appleReauthenticatePopup() {
123124
const errorCode = error.code;
124125
const errorMessage = error.message;
125126
// The email of the user's account used.
126-
const email = error.email;
127+
const email = error.customData.email;
127128
// The credential that was used.
128129
const credential = OAuthProvider.credentialFromError(error);
129130

@@ -169,7 +170,7 @@ function appleNonceNode() {
169170
crypto.randomFillSync(buf);
170171
nonce = decoder.write(buf);
171172
}
172-
return nonce.substr(0, length);
173+
return nonce.slice(0, length);
173174
};
174175

175176
const unhashedNonce = generateNonce(10);

auth-next/cordova.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@
55

66
function createGoogleProvider() {
77
// [START auth_create_google_provider]
8-
const { GoogleAuthProvider } = require("firebase/auth");
8+
const { GoogleAuthProvider } = require("firebase/auth/cordova");
99

1010
const provider = new GoogleAuthProvider();
1111
// [END auth_create_google_provider]
1212
}
1313

1414
function cordovaSignInRedirect() {
1515
// [START auth_cordova_sign_in_redirect]
16-
const { getAuth, signInWithRedirect, getRedirectResult, GoogleAuthProvider } = require("firebase/auth");
16+
const { getAuth, signInWithRedirect, getRedirectResult, GoogleAuthProvider } = require("firebase/auth/cordova");
1717

1818
const auth = getAuth();
1919
signInWithRedirect(auth, new GoogleAuthProvider())
@@ -40,7 +40,7 @@ function cordovaSignInRedirect() {
4040

4141
function cordovaRedirectResult() {
4242
// [START auth_cordova_redirect_result]
43-
const { getAuth, getRedirectResult, GoogleAuthProvider } = require("firebase/auth");
43+
const { getAuth, getRedirectResult, GoogleAuthProvider } = require("firebase/auth/cordova");
4444

4545
const auth = getAuth();
4646
getRedirectResult(auth)

auth-next/custom-dependencies.js

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
// [SNIPPET_REGISTRY disabled]
2+
// [SNIPPETS_SEPARATION enabled]
3+
4+
// Docs: https://source.corp.google.com/piper///depot/google3/third_party/devsite/firebase/en/docs/auth/web/custom-dependencies.md
5+
6+
function getAuthEquivalent() {
7+
// [START auth_get_auth_equivalent]
8+
const {initializeAuth, browserLocalPersistence, browserPopupRedirectResolver, browserSessionPersistence, indexedDBLocalPersistence} = require("firebase/auth");
9+
const {initializeApp} = require("firebase/app");
10+
11+
const app = initializeApp({/** Your app config */});
12+
const auth = initializeAuth(app, {
13+
persistence: [indexedDBLocalPersistence, browserLocalPersistence, browserSessionPersistence],
14+
popupRedirectResolver: browserPopupRedirectResolver,
15+
});
16+
// [END auth_get_auth_equivalent]
17+
}
18+
19+
function onlyBrowserLocal() {
20+
// [START auth_only_browser_local]
21+
const {initializeAuth, browserLocalPersistence} = require("firebase/auth");
22+
const {initializeApp} = require("firebase/app");
23+
24+
const app = initializeApp({/** Your app config */});
25+
const auth = initializeAuth(app, {
26+
persistence: browserLocalPersistence,
27+
// No popupRedirectResolver defined
28+
});
29+
// [END auth_only_browser_local]
30+
}
31+
32+
function onlyIndexedDB() {
33+
// [START auth_only_indexed_db]
34+
const {initializeAuth, indexedDBLocalPersistence} = require("firebase/auth");
35+
const {initializeApp} = require("firebase/app");
36+
37+
const app = initializeApp({/** Your app config */});
38+
const auth = initializeAuth(app, {
39+
persistence: indexedDBLocalPersistence,
40+
// No popupRedirectResolver defined
41+
});
42+
// [END auth_only_indexed_db]
43+
}
44+
45+
function signInRedirectManualDeps() {
46+
// [START auth_sign_in_redirect_manual_deps]
47+
const {initializeAuth, browserLocalPersistence, browserPopupRedirectResolver, indexedDBLocalPersistence, signInWithRedirect, GoogleAuthProvider} = require("firebase/auth");
48+
const {initializeApp} = require("firebase/app");
49+
50+
const app = initializeApp({/** Your app config */});
51+
const auth = initializeAuth(app, {
52+
persistence: [indexedDBLocalPersistence, browserLocalPersistence],
53+
});
54+
55+
// Later
56+
signInWithRedirect(auth, new GoogleAuthProvider(), browserPopupRedirectResolver);
57+
// [END auth_sign_in_redirect_manual_deps]
58+
}

auth-next/facebook.js

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,15 @@ function facebookSignInPopup(provider) {
3333
const credential = FacebookAuthProvider.credentialFromResult(result);
3434
const accessToken = credential.accessToken;
3535

36+
// IdP data available using getAdditionalUserInfo(result)
3637
// ...
3738
})
3839
.catch((error) => {
3940
// Handle Errors here.
4041
const errorCode = error.code;
4142
const errorMessage = error.message;
4243
// The email of the user's account used.
43-
const email = error.email;
44+
const email = error.customData.email;
4445
// The AuthCredential type that was used.
4546
const credential = FacebookAuthProvider.credentialFromError(error);
4647

@@ -61,12 +62,14 @@ function facebookSignInRedirectResult() {
6162
const token = credential.accessToken;
6263

6364
const user = result.user;
65+
// IdP data available using getAdditionalUserInfo(result)
66+
// ...
6467
}).catch((error) => {
6568
// Handle Errors here.
6669
const errorCode = error.code;
6770
const errorMessage = error.message;
6871
// The email of the user's account used.
69-
const email = error.email;
72+
const email = error.customData.email;
7073
// AuthCredential type that was used.
7174
const credential = FacebookAuthProvider.credentialFromError(error);
7275
// ...
@@ -102,7 +105,7 @@ function checkLoginState_wrapper() {
102105
const errorCode = error.code;
103106
const errorMessage = error.message;
104107
// The email of the user's account used.
105-
const email = error.email;
108+
const email = error.customData.email;
106109
// The AuthCredential type that was used.
107110
const credential = FacebookAuthProvider.credentialFromError(error);
108111
// ...
@@ -156,10 +159,19 @@ function authWithCredential(credential) {
156159
const errorCode = error.code;
157160
const errorMessage = error.message;
158161
// The email of the user's account used.
159-
const email = error.email;
162+
const email = error.customData.email;
160163
// The AuthCredential type that was used.
161164
const credential = FacebookAuthProvider.credentialFromError(error);
162165
// ...
163166
});
164167
// [END auth_facebook_signin_credential]
165168
}
169+
170+
function facebookProviderCredential(accessToken) {
171+
// [START auth_facebook_provider_credential]
172+
const { FacebookAuthProvider } = require("firebase/auth");
173+
174+
const credential = FacebookAuthProvider.credential(accessToken);
175+
// [END auth_facebook_provider_credential]
176+
}
177+

0 commit comments

Comments
 (0)