Before you can use this SDK, you need to create an account on authbird.com.
Please check out the detailed docs.
npm install @authbird/client-sdkUNPKG.com
<script src="https://unpkg.com/@authbird/client-sdk@1.0.0/lib/cjs/index.js"></script>jsDelivr.com
<script src="https://cdn.jsdelivr.net/npm/@authbird/client-sdk@1.0.0/lib/cjs/index.js"></script>After the package is installed, the library can be imported using import or require approach:
const authbird = require('@authbird/client-sdk');or
import {init, session, browser} from '@authbird/client-sdk';Initialize the SDK with your appId and appSecret.
authbird.init({
appId: '<your appId>',
appSecret: '<your appSecret>'
});To simplify the user login process for the browser, we have developed a straightforward function.
const user = await authbird.browser.loginUser('<login provider>');Example response data:
{
"accessToken": "<accessToken>",
"profile": {
"photoUrl": "<photoUrl>",
"provider": "<provider>",
"displayName": "<displayName>",
"id": "<id>",
"email": "<email>"
}
}If you desire greater control, you have the option to manage sessions on your own.
const newSession = await authbird.session.create();Example response data:
{
"sessionId": "<sessionId>",
"sessionSecret": "<sessionSecret>",
"loginUrls": {
"google": "https://api.authbird.com/auth/google?sessionId=<sessionId>",
"facebook": "https://api.authbird.com/auth/facebook?sessionId=<sessionId>"
}
}const userAuthData = await authbird.session.getUserData('<sessionSecret>');Example response data:
{
"accessToken": "<accessToken>",
"profile": {
"photoUrl": "<photoUrl>",
"provider": "<provider>",
"displayName": "<displayName>",
"id": "<id>",
"email": "<email>"
}
}The Test pipeline is triggered in push and pull requests to the main branch.
The Release pipeline is triggered when merging PR to the main branch.
It does the Github release, builds the library and publish it on npm.
The release version is calculated automatically based on commit messages using semantic release. The example table below shows which commit message gets you which release type:
| Commit message | Release type |
|---|---|
fix(pencil): stop graphite breaking when too much pressure applied |
Fix Release (Patch) |
feat(pencil): add 'graphiteWidth' option |
Feature Release (Minor) |
perf(pencil): remove graphiteWidth optionBREAKING CHANGE: The graphiteWidth option has been removed.The default graphite width of 10mm is always used for performance reasons. |
Breaking Release (Major) (Note that the BREAKING CHANGE: token must be in the footer of the commit) |
Please remember that for the CD (Continuous Deployment) to function correctly, it is essential to provide a proper commit message.
Authbird welcomes all kinds of contributions! Whether it's code fixes, feature enhancements, documentation updates, additional tests, or helping with pull requests and issues, we appreciate any support you can provide. Your contributions play a vital role in improving our project.
Join us and make a difference!