@react-native-firebase/auth 16.5.1 → 16.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/android/src/main/java/io/invertase/firebase/auth/ReactNativeFirebaseAuthModule.java +7 -1
- package/ios/RNFBAuth/RNFBAuthModule.m +4 -0
- package/lib/index.js +2 -0
- package/lib/providers/OIDCAuthProvider.js +36 -0
- package/lib/version.js +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
@@ -3,6 +3,18 @@
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
5
5
|
|
6
|
+
## [16.6.0](https://github.com/invertase/react-native-firebase/compare/v16.5.2...v16.6.0) (2023-01-27)
|
7
|
+
|
8
|
+
### Features
|
9
|
+
|
10
|
+
- **auth:** Add support for OpenID Connect provider ([#6574](https://github.com/invertase/react-native-firebase/issues/6574)) ([469bf00](https://github.com/invertase/react-native-firebase/commit/469bf004c8d4ccf3da46215e7ca7562a6739265d))
|
11
|
+
|
12
|
+
### [16.5.2](https://github.com/invertase/react-native-firebase/compare/v16.5.1...v16.5.2) (2023-01-23)
|
13
|
+
|
14
|
+
### Bug Fixes
|
15
|
+
|
16
|
+
- **auth, android:** use a safe copy of auth provider info to avoid crash ([2a90136](https://github.com/invertase/react-native-firebase/commit/2a90136cce0db6ca0f253003643f8bd856fd46a0)), closes [#6798](https://github.com/invertase/react-native-firebase/issues/6798)
|
17
|
+
|
6
18
|
### [16.5.1](https://github.com/invertase/react-native-firebase/compare/v16.5.0...v16.5.1) (2023-01-20)
|
7
19
|
|
8
20
|
**Note:** Version bump only for package @react-native-firebase/auth
|
@@ -70,6 +70,7 @@ import io.invertase.firebase.common.ReactNativeFirebaseEventEmitter;
|
|
70
70
|
import io.invertase.firebase.common.ReactNativeFirebaseModule;
|
71
71
|
import io.invertase.firebase.common.SharedUtils;
|
72
72
|
import java.text.SimpleDateFormat;
|
73
|
+
import java.util.ArrayList;
|
73
74
|
import java.util.Date;
|
74
75
|
import java.util.HashMap;
|
75
76
|
import java.util.Iterator;
|
@@ -1553,6 +1554,10 @@ class ReactNativeFirebaseAuthModule extends ReactNativeFirebaseModule {
|
|
1553
1554
|
/** Returns an instance of AuthCredential for the specified provider */
|
1554
1555
|
private AuthCredential getCredentialForProvider(
|
1555
1556
|
String provider, String authToken, String authSecret) {
|
1557
|
+
if (provider.startsWith("oidc.")) {
|
1558
|
+
return OAuthProvider.newCredentialBuilder(provider).setIdToken(authToken).build();
|
1559
|
+
}
|
1560
|
+
|
1556
1561
|
switch (provider) {
|
1557
1562
|
case "facebook.com":
|
1558
1563
|
return FacebookAuthProvider.getCredential(authToken);
|
@@ -2055,7 +2060,8 @@ class ReactNativeFirebaseAuthModule extends ReactNativeFirebaseModule {
|
|
2055
2060
|
private WritableArray convertProviderData(
|
2056
2061
|
List<? extends UserInfo> providerData, FirebaseUser user) {
|
2057
2062
|
WritableArray output = Arguments.createArray();
|
2058
|
-
|
2063
|
+
ArrayList<? extends UserInfo> providerDataCopy = new ArrayList(providerData);
|
2064
|
+
for (UserInfo userInfo : providerDataCopy) {
|
2059
2065
|
// remove 'firebase' provider data - android fb sdk
|
2060
2066
|
// should not be returning this as the ios/web ones don't
|
2061
2067
|
if (!FirebaseAuthProvider.PROVIDER_ID.equals(userInfo.getProviderId())) {
|
@@ -1126,6 +1126,10 @@ RCT_EXPORT_METHOD(useEmulator
|
|
1126
1126
|
credential = [FIROAuthProvider credentialWithProviderID:@"oauth"
|
1127
1127
|
IDToken:authToken
|
1128
1128
|
accessToken:authTokenSecret];
|
1129
|
+
} else if ([provider hasPrefix:@"oidc."]) {
|
1130
|
+
credential = [FIROAuthProvider credentialWithProviderID:provider
|
1131
|
+
IDToken:authToken
|
1132
|
+
rawNonce:nil];
|
1129
1133
|
} else {
|
1130
1134
|
DLog(@"Provider not yet handled: %@", provider);
|
1131
1135
|
}
|
package/lib/index.js
CHANGED
@@ -34,6 +34,7 @@ import FacebookAuthProvider from './providers/FacebookAuthProvider';
|
|
34
34
|
import GithubAuthProvider from './providers/GithubAuthProvider';
|
35
35
|
import GoogleAuthProvider from './providers/GoogleAuthProvider';
|
36
36
|
import OAuthProvider from './providers/OAuthProvider';
|
37
|
+
import OIDCAuthProvider from './providers/OIDCAuthProvider';
|
37
38
|
import PhoneAuthProvider from './providers/PhoneAuthProvider';
|
38
39
|
import PhoneMultiFactorGenerator from './PhoneMultiFactorGenerator';
|
39
40
|
import TwitterAuthProvider from './providers/TwitterAuthProvider';
|
@@ -54,6 +55,7 @@ const statics = {
|
|
54
55
|
FacebookAuthProvider,
|
55
56
|
PhoneMultiFactorGenerator,
|
56
57
|
OAuthProvider,
|
58
|
+
OIDCAuthProvider,
|
57
59
|
PhoneAuthState: {
|
58
60
|
CODE_SENT: 'sent',
|
59
61
|
AUTO_VERIFY_TIMEOUT: 'timeout',
|
@@ -0,0 +1,36 @@
|
|
1
|
+
/*
|
2
|
+
* Copyright (c) 2016-present Invertase Limited & Contributors
|
3
|
+
*
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
* you may not use this library except in compliance with the License.
|
6
|
+
* You may obtain a copy of the License at
|
7
|
+
*
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
*
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
* See the License for the specific language governing permissions and
|
14
|
+
* limitations under the License.
|
15
|
+
*
|
16
|
+
*/
|
17
|
+
|
18
|
+
const providerId = 'oidc.';
|
19
|
+
|
20
|
+
export default class OIDCAuthProvider {
|
21
|
+
constructor() {
|
22
|
+
throw new Error('`new OIDCAuthProvider()` is not supported on the native Firebase SDKs.');
|
23
|
+
}
|
24
|
+
|
25
|
+
static get PROVIDER_ID() {
|
26
|
+
return providerId;
|
27
|
+
}
|
28
|
+
|
29
|
+
static credential(oidcSuffix, idToken, accessToken) {
|
30
|
+
return {
|
31
|
+
token: idToken,
|
32
|
+
secret: accessToken,
|
33
|
+
providerId: providerId + oidcSuffix,
|
34
|
+
};
|
35
|
+
}
|
36
|
+
}
|
package/lib/version.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1
1
|
// Generated by genversion.
|
2
|
-
module.exports = '16.
|
2
|
+
module.exports = '16.6.0';
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@react-native-firebase/auth",
|
3
|
-
"version": "16.
|
3
|
+
"version": "16.6.0",
|
4
4
|
"author": "Invertase <oss@invertase.io> (http://invertase.io)",
|
5
5
|
"description": "React Native Firebase - The authentication module provides an easy-to-use API to integrate an authentication workflow into new and existing applications. React Native Firebase provides access to all Firebase authentication methods and identity providers.",
|
6
6
|
"main": "lib/index.js",
|
@@ -28,7 +28,7 @@
|
|
28
28
|
"plist": "^3.0.5"
|
29
29
|
},
|
30
30
|
"peerDependencies": {
|
31
|
-
"@react-native-firebase/app": "16.
|
31
|
+
"@react-native-firebase/app": "16.6.0"
|
32
32
|
},
|
33
33
|
"publishConfig": {
|
34
34
|
"access": "public"
|
@@ -36,5 +36,5 @@
|
|
36
36
|
"devDependencies": {
|
37
37
|
"@types/plist": "^3.0.2"
|
38
38
|
},
|
39
|
-
"gitHead": "
|
39
|
+
"gitHead": "6663dc24dc5697190b930aa510085a681fe81203"
|
40
40
|
}
|