@denz93/vendure-plugin-3rd-party-auth
v0.0.3
Published
A set of auth strategies to work with 3rd party such as Google, Facebook, etc
Downloads
3
Maintainers
Readme
Third-Party Auth Plugin for Vendure.io
A Vendure plugin allow users to be authenticated using third-party providers such as Google, Facebook, etc
Supported Providers
- [x] Google
- [x] Facebook
- [] 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
All strategies will need an "id_token" to verify and authenticate users to Vendure system.
"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
The plugin using email as identitfier, so make sure you request
"email"
permission from users.