import freshcom from 'freshcom-sdk'
freshcom.createAndSetAccessToken({
fresh_token: 'prt-test-aba1d92c-defb-478e-a031-40b5c27171c7',
grant_type: 'refresh_token'
// 1. Prompt the user to enter the required information.
// 2. Create a verification code, note the actual code is not returned.
return freshcom.createPhoneVerificationCode({
phoneNumber: customer.phoneNumber
// 3. Prompt the user to enter the verification code.
let customer.phoneVerificationCode = '...'
// 4. Submit the code and the user information.
freshcom.createCustomer(customer).then(function (response) {
// 5. (optional) Login the customer by creating its access token.
return freshcom.createAndSetAccessToken({
username: customer.username,
password: customer.password,
otp: customer.phoneVerificationCode,