Authentication
Lauching an SDK component requires an initial server-to-server call to our
authorization endpoint with required data email
and workspaceId
inside the
POST
body.
Obtaining an Auth Token
Request
POST /api/login/sdk
Content-Type: application/json
Authorization: Basic {{appKey}}:{{appSecret}}
{
"email": "kevin@examspark.com",
"workspaceId": "focus1f8-demo"
}
A successful authentication response returns a Base64 string to pass to your SDK Component. The token you receive will be valid for 8 hours and can be used to launch as many components for that user during that timeframe.
Response
POST /api/login/sdk
Content-Type: application/json
Authorization: Basic {{appKey}}:{{appSecret}}
{
"auth": "eyJwdXJwb3NlIjoic3NvIiwiYXBwSWQiOi..."
}
Example Launch
Use this token when you instantiate an SDK component:
<!DOCTYPE html>
<html>
<head>
<title>Campfire LTI Integration</title>
<link rel="stylesheet"
href="https://unpkg.com/modern-normalize@2.0.0/modern-normalize.css" />
<style type="text/css">
iframe {
width: 100%;
height: 90vh;
border: 1px solid #999;
}
div#app {
margin: 0 2rem;
height: 100%;
}
html, body, #tool {
height: 100%;
}
</style>
<script
src="https://unpkg.com/@campfirelearning/sdk-js@latest/dist/browser/index.js"></script>
</head>
<body>
<div id="app">
<h1>Campfire 🔥 SDK Integration</h1>
<div id="tool" name="tool"></d>
</div>
<script>
const component = new CampfireSDKv2.LiveProctor("tool", {
auth: "[auth-token]"
});
component.init({
examConfigId: "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
});
</script>
</body>
</html>