Web SDK (Javascript)
Andia selfie SDK for WEB (Chrome, Firefox, Internet Explorer 10)
Requirements
A desktop browser with full HTML5 support and access to a webcam.
** Due to the mobile web browsers restrictions, this SDK doesn't work on mobile devices **
Google Chrome 53+
Microsoft Edge 12+
Mozilla Firefox 42+
Safari 11+ (Mac)

Integration
The integration of this SDK is very straight forward.
1) Inside any HTML page just import the Javascript library before the </body> tag
<script src="https://api.andia.io/web/andiaSdk2.0.min.js"></script>
2) Include the following HTML fragment, to add a button
<div id="containerAndia"></div>
<button id="andiaBtn" type="button"
class="btnAndia"
customerId="YOUR_CUSTOMER_API_KEY"
face_id=""
action="onboarding"
callback="YOUR_CALLBACK_URL" >
<div id="labelBtn">Onboard me</div>
</button>
3) Callback
To get the result of the Selfie Validation or the Selfie Onboarding, just implement a POST data endpoint.
Response parameters
success . Boolean, true if the Selfie was made successful
data A Form Data object with the following fields.
Selfie OnBoarding Form Data Response
success: true, //true if the Selfie is a real user
error_code: 0, // 0 == no errors
error: "", // error description in case of error
user_id: "XXXXXXXX" // face_id, store this ID on your DB an associate to
// the user, to perform future selfie validations
import org.springframework.util.MultiValueMap;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.RequestBody;
@RestController
public class AndiaController {
@PostMapping("/onboarding")
public void onboarding(@RequestBody MultiValueMap<String, String> values) {
if(values.get("success").equals("true")){
// Redirect to login page
} else {
// Redirect to signup page with error message
// values.get("message")
}
}
}
Selfie Validation Form Data Response
success: true, //true if the Selfie is a Match agains the given face_id
error_code: 0, // != 0 if there is an error
error: "", // error description if error_code != 0
message: "It is a Match" // description
import org.springframework.util.MultiValueMap;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.RequestBody;
@RestController
public class AndiaController {
@PostMapping("/validate")
public void validate(@RequestBody MultiValueMap<String, String> values) {
if(values.get("success").equals("true")){
// Generate JWT and redirect to home page
} else {
// Redirect to login page with error message
// values.get("message")
}
}
}
Last updated
Was this helpful?