App with Validation Code

Hello Ionic developers,

I wrote a small app (ie just 5 views) for a client using Ionic 1, and she wants to grant access only to people that have a code she is going to distribute to her final users, similar to licensed software in other platforms. This is not exactly an authentication topic, because she does not want to deal with users and passwords, all she is doing is printing 40.000 codes and distribute them among her users. One code can be used in two devices.

A web service will keep track of the codes. There is a web method that given the code and the UUID, it will return true if the code is valid AND the UUID is associated to the code OR is the code is valid but unused (and update the table accordingly); if the code is not valid or already associated to a different device then it will return false. Also, We want to check this only the first time the app is validated, this is, once the user enters a valid code, the app won’t ask again for the code, which means that something needs to be saved locally to mark the user as valid.

Do anybody know if there is some sample or tutorial to do something like this? If not, what would approach would be?

Thank you in advance for any hint you may give me,