Registration Code Token

class privacyidea.lib.tokens.registrationtoken.RegistrationTokenClass(aToken)[source]

Token to implement a registration code. It can be used to create a registration code or a “TAN” which can be used once by a user to authenticate somewhere. After this registration code is used, the token is automatically deleted.

The idea is to provide a workflow, where the user can get a registration code by e.g. postal mail and then use this code as the initial first factor to authenticate to the UI to enroll real tokens.

A registration code can be created by an administrative task with the token/init api like this:

Example Authentication Request:

POST /token/init HTTP/1.1
Host: example.com
Accept: application/json


Example response:

HTTP/1.1 200 OK
Content-Type: application/json

   "detail": {
     "registrationcode": "12345808124095097608"
   "id": 1,
   "jsonrpc": "2.0",
   "result": {
     "status": true,
     "value": true
   "version": "privacyIDEA unknown"
classmethod get_class_info(*args, **kwds)[source]

returns a subtree of the token definition

  • key (string) – subsection identifier
  • ret (user defined) – default return value, if nothing is found

subsection if key exists or user defined

Return type:

dict or scalar

classmethod get_class_prefix()[source]
classmethod get_class_type()[source]
get_init_detail(*args, **kwds)[source]

At the end of the initialization we return the registration code.

inc_count_auth_success(*args, **kwds)[source]

Increase the counter, that counts successful authentications In case of successful authentication the token does needs to be deleted.


This method is called during the initialization process. :param param: parameters from the token init :type param: dict :return: None