Skip to content

Commit

Permalink
fix(authentication)!: no more providers are loaded by default (#151)
Browse files Browse the repository at this point in the history
  • Loading branch information
robingenz authored Jul 30, 2022
1 parent b823267 commit 20448e7
Show file tree
Hide file tree
Showing 15 changed files with 63 additions and 31 deletions.
5 changes: 5 additions & 0 deletions .changeset/fast-foxes-thank.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@capacitor-firebase/authentication": minor
---

fix!: no more providers are loaded by default (**BREAKING CHANGES**: see [`BREAKING.md`](https://github.com/capawesome-team/capacitor-firebase/blob/main/packages/authentication/BREAKING.md))
28 changes: 28 additions & 0 deletions packages/authentication/BREAKING.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,36 @@ This is a comprehensive list of the breaking changes introduced in the major ver

## Versions

- [Version 0.6.x](#version-06x)
- [Version 0.4.x](#version-04x)

## Version 0.6.x

Using the `providers` [configuration](https://github.com/capawesome-team/capacitor-firebase/tree/main/packages/authentication#configuration) option you could select which providers (Google, Facebook, ...) should be loaded by the plugin.
Previously, all providers were loaded by default.
From now on, _no providers will be loaded by default_.
Please set the `providers` configuration option and specify all providers you use.


**Example** (`capacitor.config.ts`):

```ts
/// <reference types="@capacitor/firebase-authentication" />

import { CapacitorConfig } from '@capacitor/cli';

const config: CapacitorConfig = {
plugins: {
FirebaseAuthentication: {
skipNativeAuth: false,
providers: ["apple.com", "facebook.com"],
},
},
};

export default config;
```

## Version 0.4.x

Add the following `string` element to `android/app/src/main/res/values/strings.xml` after the `resources` element:
Expand Down
12 changes: 6 additions & 6 deletions packages/authentication/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@ These SDKs can initialize on their own and collect various data.

These configuration values are available:

| Prop | Type | Description | Default | Since |
| -------------------- | --------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------- | ----- |
| **`skipNativeAuth`** | <code>boolean</code> | Configure whether the plugin should skip the native authentication. Only needed if you want to use the Firebase JavaScript SDK. **Note that the plugin may behave differently across the platforms.** Only available for Android and iOS. | <code>false</code> | 0.1.0 |
| **`providers`** | <code>string[]</code> | Configure which providers you want to use so that only the providers you need are fully initialized. If you do not configure any providers, they will be all initialized. Please note that this does not prevent the automatic initialization of third-party SDKs. Only available for Android and iOS. | <code>["apple.com", "facebook.com", "github.com", "google.com", "microsoft.com", "playgames.google.com", "twitter.com", "yahoo.com", "phone"]</code> | 0.1.0 |
| Prop | Type | Description | Default | Since |
| -------------------- | --------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------ | ----- |
| **`skipNativeAuth`** | <code>boolean</code> | Configure whether the plugin should skip the native authentication. Only needed if you want to use the Firebase JavaScript SDK. **Note that the plugin may behave differently across the platforms.** Only available for Android and iOS. | <code>false</code> | 0.1.0 |
| **`providers`** | <code>string[]</code> | Configure the providers that should be loaded by the plugin. Possible values: `["apple.com", "facebook.com", "github.com", "google.com", "microsoft.com", "playgames.google.com", "twitter.com", "yahoo.com", "phone"]` Only available for Android and iOS. | <code>[]</code> | 0.1.0 |

### Examples

Expand All @@ -72,7 +72,7 @@ In `capacitor.config.json`:
"plugins": {
"FirebaseAuthentication": {
"skipNativeAuth": false,
"providers": ["apple.com", "google.com"]
"providers": ["apple.com", "facebook.com"]
}
}
}
Expand All @@ -89,7 +89,7 @@ const config: CapacitorConfig = {
plugins: {
FirebaseAuthentication: {
skipNativeAuth: false,
providers: ["apple.com", "google.com"],
providers: ["apple.com", "facebook.com"],
},
},
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,7 @@
public class FirebaseAuthenticationConfig {

private boolean skipNativeAuth = false;
private String[] providers = new String[] {
"apple.com",
"facebook.com",
"github.com",
"google.com",
"microsoft.com",
"playgames.google.com",
"twitter.com",
"yahoo.com",
"phone"
};
private String[] providers = new String[] {};

public boolean getSkipNativeAuth() {
return skipNativeAuth;
Expand Down
2 changes: 2 additions & 0 deletions packages/authentication/docs/setup-apple.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@

## Android

1. Add `apple.com` to the `providers` [configuration](https://github.com/capawesome-team/capacitor-firebase/tree/main/packages/authentication#configuration) array.
1. See [Before you begin](https://firebase.google.com/docs/auth/android/apple#before-you-begin) and follow the instructions to configure sign-in with Apple correctly.

## iOS

1. Add `apple.com` to the `providers` [configuration](https://github.com/capawesome-team/capacitor-firebase/tree/main/packages/authentication#configuration) array.
1. See [Before you begin](https://firebase.google.com/docs/auth/ios/apple#before-you-begin) and follow the instructions to configure and enable sign-in with Apple correctly.

## Web
Expand Down
2 changes: 2 additions & 0 deletions packages/authentication/docs/setup-facebook.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## Android

1. Add `facebook.com` to the `providers` [configuration](https://github.com/capawesome-team/capacitor-firebase/tree/main/packages/authentication#configuration) array.
1. Add the following project variable to your `variables.gradle` file (usually `android/build.gradle`):
```diff
ext {
Expand Down Expand Up @@ -52,6 +53,7 @@

## iOS

1. Add `facebook.com` to the `providers` [configuration](https://github.com/capawesome-team/capacitor-firebase/tree/main/packages/authentication#configuration) array.
1. Add the `CapacitorFirebaseAuthentication/Facebook` pod to your `Podfile` (usually `ios/App/Podfile`):
```diff
target 'App' do
Expand Down
2 changes: 2 additions & 0 deletions packages/authentication/docs/setup-github.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@

## Android

1. Add `github.com` to the `providers` [configuration](https://github.com/capawesome-team/capacitor-firebase/tree/main/packages/authentication#configuration) array.
1. See [Before you begin](https://firebase.google.com/docs/auth/android/github-auth#before_you_begin) and follow the instructions to configure sign-in with GitHub correctly.
**Attention**: Skip step 6. The dependency for the Firebase Authentication Android library is already declared by the plugin.

## iOS

1. Add `github.com` to the `providers` [configuration](https://github.com/capawesome-team/capacitor-firebase/tree/main/packages/authentication#configuration) array.
1. See [Before you begin](https://firebase.google.com/docs/auth/ios/github-auth#before_you_begin) and follow the instructions to configure and enable sign-in with GitHub correctly.
**Attention**: Skip step 2. The `Firebase/Auth` pod is already added by the plugin.
1. Add custom URL schemes to your Xcode project:
Expand Down
2 changes: 2 additions & 0 deletions packages/authentication/docs/setup-google.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## Android

1. Add `google.com` to the `providers` [configuration](https://github.com/capawesome-team/capacitor-firebase/tree/main/packages/authentication#configuration) array.
1. Add the following project variable to your `variables.gradle` file (usually `android/build.gradle`):
```diff
ext {
Expand All @@ -17,6 +18,7 @@

## iOS

1. Add `google.com` to the `providers` [configuration](https://github.com/capawesome-team/capacitor-firebase/tree/main/packages/authentication#configuration) array.
1. Add the `CapacitorFirebaseAuthentication/Google` pod to your `Podfile` (usually `ios/App/Podfile`):
```diff
target 'App' do
Expand Down
2 changes: 2 additions & 0 deletions packages/authentication/docs/setup-microsoft.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@

## Android

1. Add `microsoft.com` to the `providers` [configuration](https://github.com/capawesome-team/capacitor-firebase/tree/main/packages/authentication#configuration) array.
1. See [Before you begin](https://firebase.google.com/docs/auth/android/microsoft-oauth#before_you_begin) and follow the instructions to configure sign-in with Microsoft correctly.
**Attention**: Make sure you select `Web` as the platform for your redirect URI when registering a Microsoft OAuth client (step 4).

## iOS

1. Add `microsoft.com` to the `providers` [configuration](https://github.com/capawesome-team/capacitor-firebase/tree/main/packages/authentication#configuration) array.
1. See [Before you begin](https://firebase.google.com/docs/auth/ios/microsoft-oauth#before_you_begin) and follow the instructions to configure sign-in with Microsoft correctly.
**Attention**: Make sure you select `Web` as the platform for your redirect URI when registering a Microsoft OAuth client (step 4).
1. Add custom URL schemes to your Xcode project:
Expand Down
2 changes: 2 additions & 0 deletions packages/authentication/docs/setup-phone.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@

## Android

1. Add `phone.com` to the `providers` [configuration](https://github.com/capawesome-team/capacitor-firebase/tree/main/packages/authentication#configuration) array.
1. See [Before you begin](https://firebase.google.com/docs/auth/android/phone-auth#before-you-begin) and follow the instructions to configure sign-in using a Phone Number correctly.
**Attention**: Skip step 2. The dependency for the Firebase Authentication Android library is already declared by the plugin.
1. See [Enable Phone Number sign-in for your Firebase project](https://firebase.google.com/docs/auth/android/phone-auth#enable-phone-number-sign-in-for-your-firebase-project) and follow the instructions to enable Phone Number sign-in for your Firebase project correctly.
1. See [Enable app verification](https://firebase.google.com/docs/auth/android/phone-auth#enable-app-verification) and follow the instructions to enable app verification correctly.

## iOS

1. Add `phone.com` to the `providers` [configuration](https://github.com/capawesome-team/capacitor-firebase/tree/main/packages/authentication#configuration) array.
1. See [Before you begin](https://firebase.google.com/docs/auth/ios/phone-auth#before-you-begin) and follow the instructions to configure sign-in using a Phone Number correctly.
**Attention**: Skip step 2. The `Firebase/Auth` pod is already added by the plugin.
1. See [Enable Phone Number sign-in for your Firebase project](https://firebase.google.com/docs/auth/ios/phone-auth#enable-phone-number-sign-in-for-your-firebase-project) and follow the instructions to enable Phone Number sign-in for your Firebase project correctly.
Expand Down
1 change: 1 addition & 0 deletions packages/authentication/docs/setup-play-games.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## Android

1. Add `playgames.google.com` to the `providers` [configuration](https://github.com/capawesome-team/capacitor-firebase/tree/main/packages/authentication#configuration) array.
1. Add the following project variable to your `variables.gradle` file (usually `android/build.gradle`):
```diff
ext {
Expand Down
2 changes: 2 additions & 0 deletions packages/authentication/docs/setup-twitter.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@

## Android

1. Add `twitter.com` to the `providers` [configuration](https://github.com/capawesome-team/capacitor-firebase/tree/main/packages/authentication#configuration) array.
1. See [Before you begin](https://firebase.google.com/docs/auth/android/twitter-login#before_you_begin) and follow the instructions to configure sign-in with Twitter correctly.
**Attention**: Skip step 6. The dependency for the Firebase Authentication Android library is already declared by the plugin.

## iOS

1. Add `twitter.com` to the `providers` [configuration](https://github.com/capawesome-team/capacitor-firebase/tree/main/packages/authentication#configuration) array.
1. See [Before you begin](https://firebase.google.com/docs/auth/ios/twitter-login#before_you_begin) and follow the instructions to configure and enable sign-in with Twitter correctly.
**Attention**: Skip step 2. The `Firebase/Auth` pod is already added by the plugin.
1. Add custom URL schemes to your Xcode project:
Expand Down
2 changes: 2 additions & 0 deletions packages/authentication/docs/setup-yahoo.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@

## Android

1. Add `yahoo.com` to the `providers` [configuration](https://github.com/capawesome-team/capacitor-firebase/tree/main/packages/authentication#configuration) array.
1. See [Before you begin](https://firebase.google.com/docs/auth/android/yahoo-oauth#before_you_begin) and follow the instructions to configure sign-in with Yahoo correctly.

## iOS

1. Add `yahoo.com` to the `providers` [configuration](https://github.com/capawesome-team/capacitor-firebase/tree/main/packages/authentication#configuration) array.
1. See [Before you begin](https://firebase.google.com/docs/auth/ios/yahoo-oauth#before_you_begin) and follow the instructions to configure and enable sign-in with Yahoo correctly.
1. Add custom URL schemes to your Xcode project:
1. Open your project configuration.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,4 @@
public struct FirebaseAuthenticationConfig {
var skipNativeAuth = false
var providers = ["apple.com",
"facebook.com",
"github.com",
"google.com",
"microsoft.com",
"playgames.google.com",
"twitter.com",
"yahoo.com",
"phone"]
var providers = [String]()
}
10 changes: 5 additions & 5 deletions packages/authentication/src/definitions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ declare module '@capacitor/cli' {
*/
skipNativeAuth?: boolean;
/**
* Configure which providers you want to use so that only the providers you need are fully initialized.
* If you do not configure any providers, they will be all initialized.
* Please note that this does not prevent the automatic initialization of third-party SDKs.
* Configure the providers that should be loaded by the plugin.
*
* Possible values: `["apple.com", "facebook.com", "github.com", "google.com", "microsoft.com", "playgames.google.com", "twitter.com", "yahoo.com", "phone"]`
*
* Only available for Android and iOS.
*
* @default ["apple.com", "facebook.com", "github.com", "google.com", "microsoft.com", "playgames.google.com", "twitter.com", "yahoo.com", "phone"]
* @example ["apple.com", "google.com"]
* @default []
* @example ["apple.com", "facebook.com"]
* @since 0.1.0
*/
providers?: string[];
Expand Down

0 comments on commit 20448e7

Please sign in to comment.