Skip to content

Commit

Permalink
fix(authentication): customParameters is not applied on Web (#157)
Browse files Browse the repository at this point in the history
  • Loading branch information
robingenz authored Jul 23, 2022
1 parent 2165073 commit e3ab129
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/gold-rockets-teach.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@capacitor-firebase/authentication": patch
---

fix(web): `customParameters` is not applied
12 changes: 10 additions & 2 deletions packages/authentication/src/web.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
import { WebPlugin } from '@capacitor/core';
import type {
AuthCredential as FirebaseAuthCredential,
CustomParameters,
User as FirebaseUser,
UserCredential as FirebaseUserCredential,
} from 'firebase/auth';
import {
getAdditionalUserInfo,
applyActionCode,
confirmPasswordReset,
connectAuthEmulator,
createUserWithEmailAndPassword,
FacebookAuthProvider,
getAdditionalUserInfo,
getAuth,
GoogleAuthProvider,
OAuthCredential,
Expand Down Expand Up @@ -280,7 +281,14 @@ export class FirebaseAuthenticationWeb
options: SignInOptions,
provider: OAuthProvider | GoogleAuthProvider | FacebookAuthProvider,
) {
if (options?.scopes) {
if (options.customParameters) {
const customParameters: CustomParameters = {};
options.customParameters.map(parameter => {
customParameters[parameter.key] = parameter.value;
});
provider.setCustomParameters(customParameters);
}
if (options.scopes) {
for (const scope of options.scopes) {
provider.addScope(scope);
}
Expand Down

0 comments on commit e3ab129

Please sign in to comment.