Facebook Login Component to Svelte
npm i svelte-facebook-login
// OR
yarn add svelte-facebook-login
version with typescript
npm i svelte-facebook-login@next
// OR
yarn add svelte-facebook-login@next
Note: to use this library in sapper, install as devDependency. See the link.
Local demo:
git clone https://github.com/andrelmlins/svelte-facebook-login.git
cd svelte-facebook-login
npm install && npm run dev
An example of how to use the library:
<script>
import FacebookLogin from "svelte-facebook-login";
</script>
<FacebookLogin
clientId="XXX"
state="1"
redirectUri="http://localhost:5000/"
on:success={params => console.log(params)}
on:error={error => console.log(error)}
let:onLogin
>
<button on:click={onLogin}>Facebook Login</button>
</FacebookLogin>
Component props:
Prop | Type | Description |
---|---|---|
clientId | string | Client ID for Facebook OAuth application |
state | string | Value created by the maintenance state between the request and the callback |
redirectUri | string | Registered redirect URI for Facebook OAuth application |
responseType | string | Grant type the application wants to use |
scope | string | A space-delimited list of permissions that the application requires |
pollInterval | number | Login success analysis interval |
Prop | Type | Description |
---|---|---|
success | func | Call with success |
error | func | Call with error |
request | func | Call with offset |
Prop | Type | Description |
---|---|---|
onLogin | func | Call for login |
Download stats for this NPM package
Svelte Facebook Login is open source software licensed as MIT.