New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@peapodtech/firebasedeviceflow

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@peapodtech/firebasedeviceflow

Firebase authentication for Node.js CLI applications on limited input devices via OAuth2 'Device Flow'.

latest
Source
npmnpm
Version
0.2.0
Version published
Maintainers
1
Created
Source

Firebase Device Flow

forthebadge forthebadge

Firebase authentication via OAuth2 'Device Flow' for Node.js CLI applications on limited input devices (i.e. IoT).

Build Status

Provider Setup

Google

Docs

  • Create new OAuth client ID credentials in the GCP Credentials page. For the Application Type, select "TVs and Limited Input devices".
  • Copy the Client ID and Client Secret values into either an .env file, or input directly into the config object (see test.ts).

GitHub

Docs

  • Create a new GitHub OAuth app (guide).
  • Copy the Client ID and Client Secret values into either an .env file, or input directly into the config object (see test.ts).
  • Set the Client ID and Client Secret fields in the Firebase Console under Authentication > Sign-in method > Sign-in providers > GitHub
  • Finally, copy the Authorization callback URL from the Firebase Console to your GitHub OAuth app's settings.

Example Usage

See test.ts.

  • Import FirebaseDeviceFlow.
  • Initialize your Firebase app.
  • Pass Firebase app reference and OAuth config object to DeviceFlowUI constructor. If any parameters are absent from the OAuth config object, the relevant auth provider will be excluded from the UI.
  • Execute DeviceFlowUI.signIn(). This will return a Promise<UserCredential>.

How It Works

Google has a great resource on "OAuth 2.0 for TV and Limited-Input Device Applications".

Device Flow Diagram

Development

Build and test with the usual npm run build, npm run test. For testing, you will have to initialize your own Firebase app and provider support.

Requirements

  • Node.js and npm
  • Dependencies (install with npm install)

Todo

  • Convert to Typescript
  • Change package structure for easier import (currently import { DeviceFlowUI } from 'FirebaseDeviceFlow/dist/FirebaseDeviceFlow';)
  • Fix testing
  • 'Slow down' error code handling?
  • Add more providers?

firebase

FAQ

I'm getting X error, wtf is going on?

Make sure you've done the following:

  • All per-provider setup (outlined above)

Keywords

oauth2

FAQs

Package last updated on 09 Nov 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts