@denz93/vendure-plugin-3rd-party-auth
TypeScript icon, indicating that this package has built-in type declarations

0.0.3 • Public • Published

Third-Party Auth Plugin for Vendure.io

Test CI Publish Package to npmjs Coverage

A Vendure plugin allow users to be authenticated using third-party providers such as Google, Facebook, etc

Supported Providers

  • [x] Google
  • [x] Facebook
  • [] Twitter
  • [] More?

What is does

Extend GraphQL mutation authenticate

How to use

1.Install

yarn add @denz93/vendure-plugin-3rd-party-auth

or

npm i --save @denz93/vendure-plugin-3rd-party-auth

2. Add the plugin to vendure-config.ts

import { ThirdPartyAuthPlugin } from '@denz93/vendure-plugin-3rd-party-auth'
...
export const config: VendureConfig = {
    ...
    plugins: [
        ...
        ThirdPartyAuthPlugin.init({
            google: {
                clientId: 'xxx',
                clientSecret: 'xxx'
            },
            facebook: {
                clientId: 'xxx',
                clientSecret: 'xxx'
            }
            ...
        })
    ]
}

3. Consume Graphql mutation authenticate

muation authenticate (
    input: {
        google: {
            token: "ID_TOKEN" // <== get it from Google 'sign-in' button
        }
    } {
        id
        identifier
    }
)

Note

  1. All strategies will need an "id_token" to verify and authenticate users to Vendure system.

  2. "id_token" can be retrieved by using provider's front-end libraries. The library will handle the login process and invoke a callback with "id_token". Your job is to send that token to the plugin through the mutation authenticate above.

    Google: https://developers.google.com/identity/gsi/web/guides/overview

    Facebook: https://developers.facebook.com/docs/facebook-login/web/login-button

  3. The plugin using email as identitfier, so make sure you request "email" permission from users.

Package Sidebar

Install

npm i @denz93/vendure-plugin-3rd-party-auth

Weekly Downloads

9

Version

0.0.3

License

MIT

Unpacked Size

28.4 kB

Total Files

23

Last publish

Collaborators

  • denz93