@crowdform/flex-connect-sdk
v0.0.16
Published
## Installation
Downloads
3
Keywords
Readme
FlexConnect SDK
Installation
Example
Using jQuery + Parcel Demo Example
$(function() {
// <script src="https://flex-connect-staging.web.app/main.connect.js"></script>
// clientId = flex-xyz
const sdk = new window.FlexConnect("flex-xyz", {
env: "development"
});
// must init the package
sdk.init();
// create button with class .login
$(".login").on("click", async () => {
try {
const url = await sdk.auth.login();
} catch (e) {
console.error(e);
}
});
// create button with class .logout
$(".logout").on("click", async () => {
try {
const url = await sdk.auth.logout();
} catch (e) {
console.error(e);
}
});
// add a <div class="profile"></div>
document.addEventListener("onAuthSuccess", event => {
console.log("user is logged in", event.detail.user);
// do something with user data
const profile = JSON.stringify(event.detail.user, null, 2);
$(".profile").text(profile);
$(".login").hide();
});
});
Publish Script
Deploy through github CI/CD on main branch. Hosted on Firebase.
<script src="https://flex-connect-staging.web.app/connect.js"></script>
Publish NPM Package
- Login to NPM under Crowdform organisation
- Increase
package.json
version number - run
yarn build
- run
npm publish