Send verification code to email address

I want users in my app to receive a unique code to their emails upon registration, which they need to enter inside the app in order to confirm their email and login in the app. How can I get this working with Backendless? Some of the things I need are:

  • The user should be able to ask for the confirmation email to be resend with a new code, making any previously sent codes invalid.
  • If the user exits the app and then attempts to login, it should not let them and instead redirect them again to the screen for entering a verification code.
  • The verification code needs to expire after a given period of time if not used.
  • The verification code should not be used by any other user.
  • The email sent does not have a verification link, it only provides the code.

Importantly, I need to be able to do all the above using the REST API as I’m using AppGyver to develop the front-end and unfortunately as of now, the JS SDK is not an option.


Implement an API service that does the following:

  1. Implement a method that generates code and associates it with the user in the database, also save the timestamp when the code should expire
  2. The same method from (1) uses email template to send the code to the user.
  3. Implement another method to verify the code. This is the method your app will use when the user puts the code in the app. The method would validate the code to make sure it is not expired and then mark the user that they can login.


1 Like

Hey Mark, thanks for the response. How would I implement said methods? Is there a tutorial I can get my hands on? I would also prefer to use my own custom code if possible.

Wondering now about the default email confirmation provided by Backendless:

  1. Is there a way to have the confirmation URL open the app if clicked in a mobile device? As in, if the user clicks the link using a device where they have the app installed it opens the app, otherwise it sends them to a web page.
  2. If yes to the above, is there a way to pass custom query parameters in the URL for the app to receive?
  3. What page does the default confirmation URL open? Can this be set to any link? If so, how does Backendless know the user has confirmed their URL?

Here’s a tutorial for implementing API services in Backendless:
Basic - Basic Quick Start Guide - Developing Backendless Server Code with node.js
Advanced - Setup - Developing Backendless Server Code with node.js

  1. I do not know, this is something you should research as it is strictly cliend-side functionality.
  2. See the link on email templates I sent in the previous response.
  3. By default it runs the functionality that confirms the user, there is more to it than just a page. The final page the user sees can be configured with UI Builder.


It sounds like the confirmation URL makes an API call to confirm the user, and it can be configured to redirect to another URL (e.g. a page with a thank you message) after it does so. Is this correct? Where do I actually get to specify the URL for this final page?

The URL itself is not configurable, it points a specific file pre-deployed in your app. Here’s what it looks like:

Is it possible to modify this file then? Where can it be found?

Yes, you can modify that page using UI Builder. To get there:

  1. Click the FRONTEND button in Backendless console
  2. Switch to the system UI container:
  3. Select the confirmation-confirmed page:


1 Like

Great! Is it possible to configure this page so that it renders in different languages depending on the user’s locale?

You would need to add Codeless logic to the page to render the content dynamically.

Hi Mark, is there likewise a tutorial or similar on how to that? And a last question, is it possible to resend the default email confirmation template to the user? I’m thinking in case it doesn’t arrive, it goes to junk and gets deleted, etc.

There is complete traning on UI Builder:

Course 1:
Course 2:

Yes, there is API for resending password:

POST /users/resendconfirmation/<emailAddress>
1 Like

Great, I will checkout those tutorials. There doesn’t seem to be any documentation on the REST API resendconfirmation endpoint :thinking: Does it require any body, content headers, etc?

You’re right, that API is relatively new, we haven’t had a chance to document it yet. No additional headers or request body is needed.

1 Like

How can I use codeless to detect the user’s device language? I haven’t been able to find a block which does this (similar to the Geolocation one). What I’m trying to do is to detect the user’s device language on page enter event, then render the text dynamically by choosing its content from a page variable using a lookup. Is this possible?

Hello @Juan_Giraldo

You can use a construction like that

Where no difference what component you chose, you always get a language what prefer user(this is coming from browser settings).

Here is how it looks in default JS code - window.navigator.language

I fully agree with you, if you think it looks a little scary in codeless, so I create a discussion ticket for our developer’s team to implement it in one block. If we found it useful - we add it to codeless.

Regards, Dima.

UPD: The logic for getting this is harder than I think first. Here you can see how to implement it right: