@capacitor-firebase/authentication
Advanced tools
Comparing version 0.1.1 to 0.2.0
@@ -268,2 +268,20 @@ { | ||
{ | ||
"name": "useEmulator", | ||
"signature": "(options: UseEmulatorOptions) => Promise<void>", | ||
"parameters": [ | ||
{ | ||
"name": "options", | ||
"docs": "", | ||
"type": "UseEmulatorOptions" | ||
} | ||
], | ||
"returns": "Promise<void>", | ||
"tags": [], | ||
"docs": "Instrument your app to talk to the Authentication emulator.", | ||
"complexTypes": [ | ||
"UseEmulatorOptions" | ||
], | ||
"slug": "useemulator" | ||
}, | ||
{ | ||
"name": "addListener", | ||
@@ -619,2 +637,25 @@ "signature": "(eventName: 'authStateChange', listenerFunc: AuthStateChangeListener) => Promise<PluginListenerHandle> & PluginListenerHandle", | ||
{ | ||
"name": "UseEmulatorOptions", | ||
"slug": "useemulatoroptions", | ||
"docs": "", | ||
"tags": [], | ||
"methods": [], | ||
"properties": [ | ||
{ | ||
"name": "host", | ||
"tags": [], | ||
"docs": "The emulator host (e.g. `10.0.2.2`).", | ||
"complexTypes": [], | ||
"type": "string" | ||
}, | ||
{ | ||
"name": "port", | ||
"tags": [], | ||
"docs": "The emulator port (e.g. `9099`).\n\nDefault: `9099`", | ||
"complexTypes": [], | ||
"type": "number | undefined" | ||
} | ||
] | ||
}, | ||
{ | ||
"name": "PluginListenerHandle", | ||
@@ -621,0 +662,0 @@ "slug": "pluginlistenerhandle", |
@@ -101,2 +101,6 @@ import type { PluginListenerHandle } from '@capacitor/core'; | ||
/** | ||
* Instrument your app to talk to the Authentication emulator. | ||
*/ | ||
useEmulator(options: UseEmulatorOptions): Promise<void>; | ||
/** | ||
* Listen for the user's sign-in state changes. | ||
@@ -184,2 +188,14 @@ */ | ||
} | ||
export interface UseEmulatorOptions { | ||
/** | ||
* The emulator host (e.g. `10.0.2.2`). | ||
*/ | ||
host: string; | ||
/** | ||
* The emulator port (e.g. `9099`). | ||
* | ||
* Default: `9099` | ||
*/ | ||
port?: number; | ||
} | ||
export interface SignInWithPhoneNumberResult extends SignInResult { | ||
@@ -186,0 +202,0 @@ /** |
import { WebPlugin } from '@capacitor/core'; | ||
import type { FirebaseAuthenticationPlugin, GetCurrentUserResult, GetIdTokenResult, SetLanguageCodeOptions, SignInResult, SignInWithPhoneNumberOptions, SignInWithCustomTokenOptions } from './definitions'; | ||
import type { FirebaseAuthenticationPlugin, GetCurrentUserResult, GetIdTokenResult, SetLanguageCodeOptions, SignInResult, SignInWithCustomTokenOptions, SignInWithPhoneNumberOptions, UseEmulatorOptions } from './definitions'; | ||
export declare class FirebaseAuthenticationWeb extends WebPlugin implements FirebaseAuthenticationPlugin { | ||
@@ -20,2 +20,3 @@ constructor(); | ||
useAppLanguage(): Promise<void>; | ||
useEmulator(options: UseEmulatorOptions): Promise<void>; | ||
private handleAuthStateChange; | ||
@@ -22,0 +23,0 @@ private createSignInResult; |
import { WebPlugin } from '@capacitor/core'; | ||
import { FacebookAuthProvider, getAuth, GoogleAuthProvider, OAuthCredential, OAuthProvider, signInWithPopup, signInWithCustomToken, } from 'firebase/auth'; | ||
import { connectAuthEmulator, FacebookAuthProvider, getAuth, GoogleAuthProvider, OAuthCredential, OAuthProvider, signInWithCustomToken, signInWithPopup, } from 'firebase/auth'; | ||
export class FirebaseAuthenticationWeb extends WebPlugin { | ||
@@ -98,2 +98,7 @@ constructor() { | ||
} | ||
async useEmulator(options) { | ||
const auth = getAuth(); | ||
const port = options.port || 9099; | ||
connectAuthEmulator(auth, `${options.host}:${port}`); | ||
} | ||
handleAuthStateChange(user) { | ||
@@ -100,0 +105,0 @@ const userResult = this.createUserResult(user); |
@@ -107,2 +107,7 @@ 'use strict'; | ||
} | ||
async useEmulator(options) { | ||
const auth$1 = auth.getAuth(); | ||
const port = options.port || 9099; | ||
auth.connectAuthEmulator(auth$1, `${options.host}:${port}`); | ||
} | ||
handleAuthStateChange(user) { | ||
@@ -109,0 +114,0 @@ const userResult = this.createUserResult(user); |
@@ -103,2 +103,7 @@ var capacitorFirebaseAuthentication = (function (exports, core, auth) { | ||
} | ||
async useEmulator(options) { | ||
const auth$1 = auth.getAuth(); | ||
const port = options.port || 9099; | ||
auth.connectAuthEmulator(auth$1, `${options.host}:${port}`); | ||
} | ||
handleAuthStateChange(user) { | ||
@@ -105,0 +110,0 @@ const userResult = this.createUserResult(user); |
{ | ||
"name": "@capacitor-firebase/authentication", | ||
"version": "0.1.1", | ||
"version": "0.2.0", | ||
"description": "Capacitor plugin for Firebase Authentication.", | ||
@@ -5,0 +5,0 @@ "main": "dist/plugin.cjs.js", |
@@ -164,2 +164,9 @@ # @capacitor-firebase/authentication | ||
}; | ||
const useEmulator = async () => { | ||
await FirebaseAuthentication.useEmulator({ | ||
host: '10.0.2.2', | ||
port: 9099, | ||
}); | ||
}; | ||
``` | ||
@@ -186,2 +193,3 @@ | ||
* [`useAppLanguage()`](#useapplanguage) | ||
* [`useEmulator(...)`](#useemulator) | ||
* [`addListener('authStateChange', ...)`](#addlistenerauthstatechange) | ||
@@ -441,2 +449,17 @@ * [`removeAllListeners()`](#removealllisteners) | ||
### useEmulator(...) | ||
```typescript | ||
useEmulator(options: UseEmulatorOptions) => Promise<void> | ||
``` | ||
Instrument your app to talk to the Authentication emulator. | ||
| Param | Type | | ||
| ------------- | ----------------------------------------------------------------- | | ||
| **`options`** | <code><a href="#useemulatoroptions">UseEmulatorOptions</a></code> | | ||
-------------------- | ||
### addListener('authStateChange', ...) | ||
@@ -574,2 +597,10 @@ | ||
#### UseEmulatorOptions | ||
| Prop | Type | Description | | ||
| ---------- | ------------------- | ------------------------------------------------ | | ||
| **`host`** | <code>string</code> | The emulator host (e.g. `10.0.2.2`). | | ||
| **`port`** | <code>number</code> | The emulator port (e.g. `9099`). Default: `9099` | | ||
#### PluginListenerHandle | ||
@@ -576,0 +607,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
209126
2436
656