okta-react-native icon indicating copy to clipboard operation
okta-react-native copied to clipboard

[Help Needed] Adding the deviceToken in the latest SDK

Open konampruthvirajkumar opened this issue 3 years ago • 5 comments

I have recently upgraded the OKTA SDK to version 2.2.0. Earlier there is option to send the deviceToken with signIn that helped not to trigger the MFA_REQUIRED on the same device. But now I am not seeing that option instead I can see the sendFingerPrint boolean.

Can you please advise on this

konampruthvirajkumar avatar Jan 20 '22 14:01 konampruthvirajkumar

Hello @konampruthvirajkumar

Thanks for raising the issue.

The latest version has upgraded dependencies, including okta-auth-js. There's a migration guide from version 4.x to 5.x.

Could you, please, provide a sample code that you used before?

oleggnidets-okta avatar Jan 20 '22 15:01 oleggnidets-okta

@oleggnidets-okta , that was so quick. thank you for responding.

here is the code from version 1.x.x

  try {
    const options = {
      multiOptionalFactorEnroll: true,
      warnBeforePasswordExpired: false,
    };
    const context = { deviceToken };
    return await authClient.signIn({ username, password, options, context });
  } catch (error) {
    throw error;
  }
}````

{
  "username": "[email protected]",
  "password": "correcthorsebatterystaple",
  "options": {
    "multiOptionalFactorEnroll": true,
    "warnBeforePasswordExpired": false
  },
  "context": {
    "deviceToken": "26q43Ak9Eh04p7H6Nnx0m69JqYOrfVBY"
  }

ghost avatar Jan 20 '22 15:01 ghost

I discussed the issue with my colleague and we think the code looks good. signIn method can still pass deviceToken without any code change.

We think it may be type issue. Do you use TypeScript?

oleggnidets-okta avatar Jan 20 '22 16:01 oleggnidets-okta

thanks for the confirmation. yes I am using Typescript.

ghost avatar Jan 20 '22 16:01 ghost

So the issue comes from SigninOptions.context. For now being, it's typed as string but should be an object, internal ticket OKTA-462292.

As a current solution try to pass an argument as a string.

oleggnidets-okta avatar Jan 20 '22 16:01 oleggnidets-okta