npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

vojto-capacitor-firebase-authentication

v0.3.2

Published

Capacitor plugin for Firebase Authentication.

Downloads

3

Readme

About

This plugin is an implementation of Firebase Auth using the native Firebase SDK for Java (Android) and Swift (iOS). When using this plugin the user will be authenticated into the native layer. This means that you can use other native plugins that require authenticated firebase users.

If you also want to use the Firebase JS SDK in your app, you will need to make sure that the web layer also gets authenticated. This is not yet built into this plugin by default. See #41 for more information on this.

Maintainers

| Maintainer | GitHub | Social | | ---------- | ----------------------------------------- | --------------------------------------------- | | Robin Genz | robingenz | @robin_genz |

Installation

npm install @robingenz/capacitor-firebase-authentication
npx cap sync

Add Firebase to your project if you haven't already (Android / iOS).

On iOS, verify that this function is included in your app's AppDelegate.swift:

func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
  return ApplicationDelegateProxy.shared.application(app, open: url, options: options)
}

The further installation steps depend on the selected authentication method:

Configuration

No configuration required for this plugin.

Usage

import { FirebaseAuthentication } from '@robingenz/capacitor-firebase-authentication';

const getCurrentUser = async () => {
  const result = await FirebaseAuthentication.getCurrentUser();
  return result.user;
};

const getIdToken = async () => {
  const result = await FirebaseAuthentication.getIdToken();
  return result.token;
};

const setLanguageCode = async () => {
  await FirebaseAuthentication.setLanguageCode({ languageCode: 'en-US' });
};

const signInWithApple = async () => {
  await FirebaseAuthentication.signInWithApple();
};

const signInWithGithub = async () => {
  await FirebaseAuthentication.signInWithGithub();
};

const signInWithGoogle = async () => {
  await FirebaseAuthentication.signInWithGoogle();
};

const signInWithMicrosoft = async () => {
  await FirebaseAuthentication.signInWithMicrosoft();
};

const signInWithTwitter = async () => {
  await FirebaseAuthentication.signInWithTwitter();
};

const signInWithYahoo = async () => {
  await FirebaseAuthentication.signInWithYahoo();
};

const signOut = async () => {
  await FirebaseAuthentication.signOut();
};

const useAppLanguage = async () => {
  await FirebaseAuthentication.useAppLanguage();
};

API

getCurrentUser()

getCurrentUser() => Promise<GetCurrentUserResult>

Fetches the currently signed-in user.

Only available for Android and iOS.

Returns: Promise<GetCurrentUserResult>


getIdToken(...)

getIdToken(options?: GetIdTokenOptions | undefined) => Promise<GetIdTokenResult>

Fetches the Firebase Auth ID Token for the currently signed-in user.

Only available for Android and iOS.

| Param | Type | | ------------- | --------------------------------------------------------------- | | options | GetIdTokenOptions |

Returns: Promise<GetIdTokenResult>


setLanguageCode(...)

setLanguageCode(options: SetLanguageCodeOptions) => Promise<void>

Sets the user-facing language code for auth operations.

| Param | Type | | ------------- | ------------------------------------------------------------------------- | | options | SetLanguageCodeOptions |


signInWithApple()

signInWithApple() => Promise<SignInResult>

Starts the Apple sign-in flow.

Only available for Android and iOS.

Returns: Promise<SignInResult>


signInWithGithub()

signInWithGithub() => Promise<SignInResult>

Starts the GitHub sign-in flow.

Only available for Android and iOS.

Returns: Promise<SignInResult>


signInWithGoogle()

signInWithGoogle() => Promise<SignInResult>

Starts the Google sign-in flow.

Only available for Android and iOS.

Returns: Promise<SignInResult>


signInWithMicrosoft()

signInWithMicrosoft() => Promise<SignInResult>

Starts the Microsoft sign-in flow.

Only available for Android and iOS.

Returns: Promise<SignInResult>


signInWithTwitter()

signInWithTwitter() => Promise<SignInResult>

Starts the Twitter sign-in flow.

Only available for Android and iOS.

Returns: Promise<SignInResult>


signInWithYahoo()

signInWithYahoo() => Promise<SignInResult>

Starts the Yahoo sign-in flow.

Only available for Android and iOS.

Returns: Promise<SignInResult>


signOut()

signOut() => Promise<void>

Starts the sign-out flow.

Only available for Android and iOS.


useAppLanguage()

useAppLanguage() => Promise<void>

Sets the user-facing language code to be the default app language.


Interfaces

GetCurrentUserResult

| Prop | Type | Description | | ---------- | --------------------------------------------- | --------------------------------------------------------- | | user | User | null | The currently signed-in user, or null if there isn't any. |

User

| Prop | Type | | ------------------- | --------------------------- | | displayName | string | null | | email | string | null | | emailVerified | boolean | | isAnonymous | boolean | | phoneNumber | string | null | | photoUrl | string | null | | providerId | string | | tenantId | string | null | | uid | string |

GetIdTokenResult

| Prop | Type | Description | | ----------- | ------------------- | -------------------------------------- | | token | string | The Firebase Auth ID token JWT string. |

GetIdTokenOptions

| Prop | Type | Description | | ------------------ | -------------------- | --------------------------------------------- | | forceRefresh | boolean | Force refresh regardless of token expiration. |

SetLanguageCodeOptions

| Prop | Type | Description | | ------------------ | ------------------- | --------------------------------------- | | languageCode | string | BCP 47 language code. Example: en-US. |

SignInResult

| Prop | Type | Description | | ---------------- | ------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------- | | user | User | null | The currently signed-in user, or null if there isn't any. | | credential | AuthCredential | OAuthCredential | null | | | rawNonce | string | null | |

AuthCredential

| Prop | Type | | -------------- | --------------------------- | | provider | string | null |

OAuthCredential

| Prop | Type | | ----------------- | --------------------------- | | accessToken | string | null | | idToken | string | null | | providerId | string | null |

Changelog

See CHANGELOG.md.

License

See LICENSE.