JSPM

remix-auth-google-credential

0.1.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • 0
  • Score
    100M100P100Q15853F
  • License MIT

Package Exports

  • remix-auth-google-credential
  • remix-auth-google-credential/build/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (remix-auth-google-credential) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Remix Auth Google Credential

$ npm i remix-auth-google-credential google-auth-library

remix-auth-google-credential depends on google-auth-library for verifying the provided credential

Supported runtimes

Runtime Has Support
Node.js
Cloudflare ?

Not sure if google-auth-library supports workers

How to use

This strategy accepts Google credential responses via FormData. This strategy supports Google one-tap html and javascript api. When using html api, set login_uri attribute to the strategy endpoint. When using javascript api, send credentials to straregy endpoint via fetcher.

Create the strategy instance

You must initialize the google-credential strategy in your auth.server.ts file.

// app/server/auth.server.ts
import { GoogleCredentialStrategy } from "remix-auth-google-credential";

// Create an instance of the authenticator, pass a generic <User> type which the
// strategies will return (this will be stored in the session)
export let authenticator = new Authenticator<User>(sessionStorage, { sessionErrorKey });

authenticator.use(new GoogleStrategy(
  {
    clientId: "YOUR_CLIENT_ID",
    credentialId: "credential", // name of form field that stores credential. Default: credential
  },
  async (profile) => {
    return findOrCreateUser(profile);
  }
));