Examples - AFS

AFS Integration Guide

Product
AFS
AFS_Version
7.9
Category
Reference Guide

Functions login and loginFromAuthKey need some information to be passed in a JSON parameter.

Required information is detailed in the following examples.

In addition to the mandatory ones, a 'success' and 'error' callback can be provided in each login functions.

function onAppReady()
{
if (!AFSWidget.sdk.cks.user.auth.isLoggedIn()) {

AFSWidget.sdk.cks.user.auth.login({
login: 'johndoe',
password: 'mypass',
success: console.log,
error: console.error
});

// AFSWidget.sdk.cks.user.auth.loginFromAuthKey({
// authKey: 'xLEVujvNi9ifDceLnLyYhkKEG4gWT',
// success: console.log,
// error: console.error
// });

// AFSWidget.sdk.cks.user.auth.autoLogin({
// success: console.log,
// error: console.error
// });
}
}

Be sure the SDK is available and ready to use before making calls to it. See 'appReadyCallback' in SDK configuration.