https://github.com/simple-login/sdk.js
SimpleLogin JS SDK
https://github.com/simple-login/sdk.js
sdk simplelogin
Last synced: 12 months ago
JSON representation
SimpleLogin JS SDK
- Host: GitHub
- URL: https://github.com/simple-login/sdk.js
- Owner: simple-login
- License: mit
- Created: 2019-08-12T08:28:04.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2022-07-07T11:16:33.000Z (almost 4 years ago)
- Last Synced: 2025-06-04T13:15:37.771Z (about 1 year ago)
- Topics: sdk, simplelogin
- Language: JavaScript
- Size: 131 KB
- Stars: 4
- Watchers: 3
- Forks: 2
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG
- License: LICENSE
Awesome Lists containing this project
README
# SimpleLogin sdk.js
The [SimpleLogin](https://simplelogin.io) sdk.js library is created to facilitate adding SimpleLogin button to your webapp.
The SDK is based on [hello.js](https://github.com/MrSwitch/hello.js).
To use it, first include the SDK into the html and add the "Login with SimpleLogin" button:
```html
Login with Simplelogin
```
Second, use it to log user in. Please make sure to replace `{your SimpleLogin client-oauth-id}`.
```js
SL.init("{your SimpleLogin client-oauth-id}");
document.getElementById("btn-simplelogin").onclick = function(e) {
SL.login(function(user) {
console.log("got user from SL SDK", user);
document.getElementById("user-info").innerHTML = `
email: ${user.email}
name: ${user.name}
avatar:
`
})
}
```
Voilà, simple (as in SimpleLogin) isn't it 😉?
This example also included in [example](./example)
## Doc:
Adding the SDK will add the object `SL` to `window`. There are 2 main methods:
`SL.init("your oauth client id")`: init SDK
`SL.login(callback)`: once user is logged in, `callback` will be called with `user` as parameter.