Widgets
36Blocks gives you four embeddable widgets. Each one is a small snippet you add to a page in your app; 36Blocks renders the UI and handles the logic behind it.
| Widget | type |
What it does |
|---|---|---|
| Authentication | authorization |
Login and sign-up for your users, using the methods you enabled on your Block. |
| Organization | organization-details |
Lets a user view and edit their current company's details. Editing requires the update_c_company permission. |
| Management | user-management |
Lists the current company's members. With the right permission, a user can change other members' roles or remove them. |
| Profile | user-profile |
Lets a user view and edit their own details, and view or leave the companies they belong to. |
Embedding a widget
Copy the embed code from your Block and paste it into your page. All four widgets use the same pattern; only type changes:
<div id="YOUR_BLOCK_REFERENCE_ID"></div>
<script type="text/javascript">
var configuration = {
referenceId: 'YOUR_BLOCK_REFERENCE_ID',
type: 'authorization',
success: (data) => {
console.log('success response', data);
},
failure: (error) => {
console.log('failure reason', error);
},
};
</script>
<script
type="text/javascript"
onload="initVerification(configuration)"
src="https://proxy.msg91.com/assets/proxy-auth/proxy-auth.js"
></script>
Replace YOUR_BLOCK_REFERENCE_ID with your Block's reference ID.
Authentication widget options
state: any value you pass is echoed back unchanged on the redirect after login. See Redirect Parameters.addInfo.redirect_path: redirects the user somewhere other than the Block's default redirect URL after login. See Redirect Parameters.
Previewing widgets
Use Preview Widgets in the dashboard to get embed code for all four widgets. The Profile, Management and Organization previews start locked. Sign in through the preview Authentication widget first to unlock them.
Where signed-in widgets get their data
The Profile, Management and Organization widgets work for the user who is currently signed in, and respect that user's role and permissions in their current company. See Companies and Roles & Permissions.