Unable to get 2FA to work

We are trying to set up 2FA on our app based on the instructions provided here

The plugin/feature was installed from Marketplace
image

The Users table has the additional columns

image

When we try to register a user using the register endpoint of the UserService.
We get the following response

  • the transaction id is not present,
  • the twoFA_secret and twoFA_qrURL is null.
  • Only twoFactorAuthentication is set to true

Without these we cant proceed to the next step.

Request

image

Response

image

Instead of Registering with 2FA we also tried enabling 2FA for an existing user using the /enable2fa PUT method

In the response we get the totpQR_Path and totpSecretKey and adding the key to the Authenticator works.

There is no transaction id provided here which is as per your documentation. But the user record in the database still has twoFactorAuthentication = False

If we try to login as the user, the response does not have a transaction id that can use to carry out 2fa with the /auth POST endpoint as it requires the transaction id and the authenticator code.

We manually updated twoFactorAuthentication = True and tried to login again, it still does not provide a transaction id.

Could you please let us know what are we doing incorrectly and what changes are needed to make this work on our app?

Thanks
Fabio

Hi @Fabio_Carvalho_FLRS,

We are currently looking into your issue and will answer as soon as possible.

Regards,
Bohdan

Hello @Fabio_Carvalho_FLRS,

could you please try renaming your columns:
twoFactorAuth → totpAuthEnabled
twoFA_qrURL → totpQR_Path
twoFA_secret → totpSecretKey

And try again after these changes.

Also, do you use the Twilio plugin in your app? Is it working fine for you or do you have the same issue?

Hi Stanislaw,

We changed the columns as you suggested. When calling the register endpoint we get the following error

Request:
image

Response:

Thanks
Fabio

Hello @Fabio_Carvalho_FLRS

I apologize for the inconvenience. An internal ticket for this problem has already been created. We will notify you as soon as the fix is available.

Regards,
Inna

The issue has been fixed. You need to uninstall and install 2FA Login service again. Please let me know if the fix helped you.

Regards,
Inna

Thanks guys for your help. We’ve tested the endpoints and are implementing the feature.

Thanks
Fabio

1 Like

Hello ,
we are also facing same issue while register the new user.
i have added new column as requested in document
twoFactorAuth
twoFA_qrURL
twoFA_secret

and try follownig rest api

https://api.backendless.com/4E129FA8-ED2B-5021-FF84-966E95BC0D00/*/users/register
{
“email":"bhargav+3@dwaravati.com”,
“password” : “*”,
“twoFactorAuth”:true
}

but i did not get any transaction code and in response i get following oupput

“twoFactorAuth”: true,
“twoFA_qrURL”: null,
“twoFA_secret”: null,

can you please suggest me the best rout to do this

Hello @bhargav,

I have answered you here:

Regards,
Stanislaw

hello
Thank you it working in rest API call after changing the column name

but
I’m encountering an error during the login process in my .NET Core API. When I attempt to log in as a user with two-factor authentication (2FA) enabled, an error is thrown. Please review the attached screenshot for details.

i tried to down load new DLL and configured in my application but still getting same error

Hello @bhargav,

thanks for the clarification! I see the problem.
I’ve created an internal ticket to resolve the issue.
We’ll notify you when it is fixed.

Regards,
Stanislaw

Can you try to logout before login if method IsValidUserToken() return false or Login method returns this error.

Regards, Nikita.

  1. I tried to login with new user but still getting same error.

  2. what need to pass in usertoken (https://api.backendless.com/api/users/isvalidusertoken/userToken)

NOTE

According to the provided documentation, the API methods for user registration and login are outlined as follows:

  • Backendless.Users.register
  • Backendless.Users.login

However, after configuring the .NET SDK and referencing the Backendless DLL in my project, I found that the access to these methods is structured differently. Instead of accessing Backendless.Users, I must use Backendless.UserService to perform actions as follows:

  • Backendless.UserService.Login
  • Backendless.UserService.Register

I wanted to confirm whether this difference is intentional or if there may be an issue with my configuration. Any guidance you can provide regarding this difference would be greatly appreciated.

hello can you please provide support for upper query!

https://backendless.com/docs/dotnet/users_login.html

public BackendlessUser Backendless.UserService.login( String identity, 
                                                      String password );

public BackendlessUser Backendless.UserService.Login( String identity, 
                                                      String password, 
                                                      bool stayLoggedIn )

https://backendless.com/docs/dotnet/users_user_registration.html

public BackendlessUser Backendless.UserService.Register( BackendlessUser user );

Here the methods for registration and for login.
Maybe you are looking to a wrong sdk?
And another question, have you tried to call logout before login?
Backendless.UserService.Logout();

Regards, Nikita.

Hello I tried with logout but still getting same error please see attached screen shot…

can you provide me the latest SDK/DLL so that i can configure it.

Which version are you using now?

The latest version at nuget: NuGet Gallery | Backendless.NET 6.7.1 - 6.7.1.
You can add with this line, or with interface in your IDE.
dotnet add package Backendless.NET --version 6.7.1

Best Regards, Nikita.

Hello Nikita,

I have update the version in my project but still getting same error.

Ok, we will look into this problem as soon as possible.