Github Login Component to Svelte
npm i svelte-github-login
// OR
yarn add svelte-github-login
Note: to use this library in sapper, install as devDependency. See the link.
Local demo:
git clone https://github.com/andrelmlins/svelte-github-login.git
cd svelte-github-login
npm install && npm run dev
An example of how to use the library:
<script>
import GithubLogin from "svelte-github-login";
</script>
<GithubLogin
clientId="XXX"
scope="user:email"
redirectUri="http://localhost:5000/"
on:success={params => console.log(params)}
on:error={error => console.log(error)}
let:onLogin
>
<button on:click={onLogin}>Github Login</button>
</GithubLogin>
Raw component props (before transform):
Prop | Type | Description |
---|---|---|
clientId | string | Client ID for GitHub OAuth application |
scope | string | A space-delimited list of permissions that the application requires |
redirectUri | string | Registered redirect URI for GitHub OAuth application |
state | string | Value created by the maintenance state between the request and the callback |
allowSignup | string | Option of unauthenticated users to register |
login | string | Suggests a specific account to use for signing in and authorizing the app. |
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 Github Login is open source software licensed as MIT.