Chatroll’s Single Sign-On (SSO) API enables integration of the Chatroll module with your existing website or app’s user profile system.
By integrating with Chatroll’s SSO API, you can:
- Have users who log in to your website or app authenticate automatically with Chatroll.
- Use your website or app’s own user profile system. Usernames, profile page links and avatars are displayed in the chat.
- Limit access to the chat to authenticated users only. This can be an effective security precaution, since users will only be able to access the chat after signing into your system.
How to Enable SSO
Follow these steps to enable Chatroll SSO within your website or app:
- Go to your chat Dashboard and click Embed Code.
- Chatroll provides several pre-packaged SSO plugins. If you see your website or app platform listed, click the appropriate icon.
- If your website or app platform is not listed, click the Custom Application icon.
- Follow the instructions provided.
For more information about the SSO API, please see below.
SSO API and Parameters
The SSO API parameters are passed to Chatroll as HTTP GET parameters, by appending them to the Chatroll iframe embed URL.
Sample iframe embed HTML with SSO API parameters
1 |
<iframe width='450' height='350' frameborder='0' scrolling='no' marginheight='0' marginwidth='0' allowtransparency='true' src='https://chatroll.com/embed/chat/ssodemo?id=3oO1ZiImrEK&uid=0001&uname=Sally%20Jones&upic=http%3A%2F%2Fimages.chatroll.com%2Fimages%2Fi%2F9%2Fi%2Fi9ilOXZQpbL.jpg&ulink=http%3A%2F%2Fexample.com%2Fsally&ismod=0&sig=1e41a7e151d00a70313749f1a78831c6'></iframe> |
Result:
Parameter Specifications
Parameter | Description and Usage | Valid Values | Required/ Optional |
---|---|---|---|
uid |
Unique User ID of signed-in user. Provided by you. | Alphanumeric string, dash (-) and underscore (_).
Limited to 64 characters. Set uid to 0 to sign out the user. |
Required |
uname |
Username that is displayed. | URL encoded UTF-8 string.
Limited to 64 characters long. |
Required |
upic |
Publicly accessible URL path to the user’s profile picture. A default image will be displayed if this value is not specified. | URL encoded path to a .JPG, .PNG or .GIF picture.
Limited to 1024 characters. |
Optional |
ulink |
URL link to the user’s profile page. If specified, the username and profile picture will be linked to this URL. | URL encoded path.
Limited to 1024 characters. |
Optional |
ismod |
Specifies whether the user has moderation privilege. Moderators can delete all posted messages and ban unwanted users. | 1 or 0.
1 = has moderation privilege 0 = no moderation privilege |
Required |
sig |
Authentication signature for request validation. All Profile API parameters will be ignored if this value is invalid or missing. | MD5 hash of the concatenated string: uid + uname + ismod + secretkey | Required |
PHP Code Sample for Chatroll SSO Integration
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
<?php // Chatroll Single Sign-On (SSO) Parameters $uid = 1; // Current user id $uname = 'test'; // Current user name $ulink = 'http://example.com/profile/test'; // Current profile URL (leave blank for none) $upic = ''; // Current profile picture URL (leave blank for none) $ismod = 0; // Is current user a moderator? 1=true, 0=false $sig = md5($uid . $uname . $ismod . '<your api key>'); $ssoParams = '&uid=' . $uid . "&uname=" . urlencode($uname) . "&ulink=" . urlencode($ulink) . "&upic=" . urlencode($upic) . "&ismod=" . $ismod . "&sig=" . $sig; ?> <iframe width='450' height='350' src='https://chatroll.com/embed/chat/ssodemo?id=3oO1ZiImrEK&platform=php<?= $ssoParams?>' frameborder='0'scrolling='no' marginheight='0' marginwidth='0' allowtransparency='true'></iframe> |