Direct Connect DIM Callbacks

Documentation for the 'loan-servicers-login' DIM callbacks

onSuccess

This method is called when a user successfully authenticates his/her loan account. We pass a token in the callback method's metadata and close the drop-in.

onSuccess(metadata){
    // your code
}

{
    'eventName': 'AUTH_SUCCESS',
    'message': 'User authentication is successful',
    'metadata': {
        'token': '{jwt}',
    }
}

If you need to access the values contained within the jwt, you can use a library such as *jwt-decode.

import jwtDecode from "jwt-decode";
const decodedValues = jwtDecode(token);

A decoded token can have 2 types of values:

  1. This is a new loan servicer account, which results in a new user on the Spinwheel platform
{
    'userId': '{userId}',
    'extUserId': '{extUserId}',
}
  1. Multiple users have connected to this loan servicer account
{
    'matchedUsers': [
        {
            'userId': '{userId}',
            'extUserId': '{extUserId}',
        },
        {
            'userId': '{userId}',
            'extUserId': '{extUserId}',
        }
    ],

}

onEvent

The Connect Drop-in Module triggers the following events:

  • INVALID_LOGIN_ATTEMPT - this event is triggered when a user attempts to authenticate with invalid credentials.
  • USER_LOGGED_OUT - this event is triggered when a user is logged out for security reasons.
  • USER_ACCOUNT_LOCKED - this event is triggered when a user's account is locked.
  • LOGIN_REQUEST_TIMEOUT - this event is triggered when the authentication API times out.
onEvent(metadata) {
  // your code goes here
}

{
    'eventName': '{eventName}',
    'message': '{message}'
}

To learn more about our debt APIs and 1-click solutions, visit spinwheel.io.