• Stars
    star
    169
  • Rank 224,453 (Top 5 %)
  • Language Svelte
  • Created over 5 years ago
  • Updated about 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Social Auth for Svelte v3




Svelte Social Auth

js-standard-style svelte-v3 publish

Google and Facebook Auth

SvelteKit SSR Ready Svelte v3

installation

npm i @beyonk/svelte-social-auth --save-dev

Usage

<GoogleAuth clientId="your-google-auth-client-id" on:auth-success={e => console.dir(e.detail.user)} />
<FacebookAuth appId="your-facebook-app-id" on:auth-success={e => console.dir(e.detail.user)} />

<script>
  import { GoogleAuth, FacebookAuth } from '@beyonk/svelte-social-auth'
</script>

Customising the buttons

Buttons have default graphics and text, however, both buttons are slotted, so simply put the button content you want inside:

<GoogleAuth>
  <div>my custom content</div>
</GoogleAuth>

Attributes

Common attributes:

Attribute Description Type Default
text Text of the sign-in button string 'Sign in with '

The attributes for the GoogleAuth component are:

Attribute Description Type Default
clientId Google service account client id string -

The attributes for the FacebookAuth component are:

Attribute Description Type Default
appId Facebook app id string -

Events

The events fired by the GoogleAuth component are:

Event Purpose Properties
on:auth-success User authentication success { user }
on:auth-failure User authentication failure { error }
on:init-error Google Auth initialisation failure { error }

The events fired by the FacebookAuth component are:

Event Purpose Properties
on:auth-success User authentication success { user }
on:auth-failure User authentication failure { error }

Developing / Contributing

Note that Facebook requires that you have HTTPS locally, despite their documentation to the contrary, so you will need to generate some SSL certs and point rollup config at them.

Put your app and client ids in an .env file

.env.local
VITE_GOOGLE_CLIENT_ID=<your-google-client-id>
VITE_FACEBOOK_APP_ID=<your-facebook-app-id>
``

```bash
pnpm dev

More Repositories

1

svelte-mapbox

MapBox Map and Autocomplete components for Svelte (or Vanilla JS)
Svelte
342
star
2

svelte-notifications

Svelte toast notifications component that can be used in any JS application
Svelte
309
star
3

gdpr-cookie-consent-banner

A GDPR compliant cookie consent banner implementation
Svelte
250
star
4

svelte-carousel

A super lightweight, super simple Carousel for Svelte 3
Svelte
213
star
5

svelte-datepicker

A lightweight datepicker written in Svelte
Svelte
141
star
6

sapper-rbac

RBAC for Sapper
JavaScript
81
star
7

svelte-googlemaps

Svelte Google Maps Components
Svelte
79
star
8

svelte-google-analytics

Google Analytics component for Svelte
JavaScript
77
star
9

http

An isomorphic http client for Svelte applications
JavaScript
45
star
10

svelte-scrollspy

Scroll Spy component for Svelte
JavaScript
38
star
11

now-sapper-demo

Now v2 (Serverless) Sapper Application
JavaScript
23
star
12

svelte-facebook-pixel

A facebook pixel module for Svelte / SvelteKit
Svelte
22
star
13

svelte-toggle

Toggle component for Svelte
Svelte
22
star
14

async-script-loader

Asynchronous script loading for SPAs
JavaScript
17
star
15

svelte-steps

Progress Steps component for Svelte
Svelte
17
star
16

svelte-component-livereload-template

Svelte component template with LiveReload and Jest unit testing
JavaScript
14
star
17

svelte-simple-icons

Simple Brand Icons for Svelte
JavaScript
13
star
18

svelte-tag-input

A super simple, extremely lightweight tag input for Svelte and Vanilla JS
CSS
8
star
19

reorient

Transforms json from one format into another
JavaScript
7
star
20

now-v2-ghost

Experiment trying to get ghost to run on now's v2 platform
CSS
7
star
21

svelte-facebook-customer-chat

Facebook Messaging Platform - Customer Chat Integration
HTML
6
star
22

svelte-scheduler

Scheduling and Calendaring component for Svelte
JavaScript
5
star
23

svelte-trustpilot

Svelte / Vanilla JS Trustpilot Widget with proper SPA support
Svelte
4
star
24

pino-logtail

Pino Logtail log transport
JavaScript
3
star
25

svelte-slim-select

A thin svelte wrapper around slim-select
HTML
3
star
26

svelte-favicons

A favicons generator for your web application.
HTML
3
star
27

initials-avatar

Create avatars from user initials in pure javascript
JavaScript
3
star
28

marker-clusterer-ssr

An SSR compatible implementation of Google Maps MarkerClusterer
JavaScript
2
star
29

svelte-intercom

Intercom for Svelte or Vanilla JS Apps
JavaScript
2
star
30

hapi-view-models

View model support for hapi
JavaScript
2
star
31

blemish

Super simplistic markdown parser
JavaScript
2
star
32

promise-retry

Retryable promises for node and the browser
JavaScript
1
star
33

sanity-template-sveltekit-basic

Empty Sanity SvelteKit Template
JavaScript
1
star
34

svelte-usetiful

Single tag Usetiful integration for Svelte
Svelte
1
star