User LOG-IN
For you are authenticate in OpenGate you have to do LOG-IN to obtain a token JWT or an ApiKey:
Do LOGIN
Basic Log-in
Do you need an email and password.
Log-in with Doble Factor of Authentication
Do you need an email, password and an 2FA Code generated.
How can you generate the 2FA code?
First, you have to configure your application to generate codes.
Configure your application
When you do LOG-IN in OpenGate, the first time after configuring 2FA, the LOG-IN service responds with an error code 401, but in the headers contains an URL in the attribute location with the parameters of configuration.
You have to use this parameters to configure your application to generate the codes.
The URL of location will be like this otpauth://totp/2FA?secret=CAX3VP5O7GWZXUDWQOK4267DGXXSFIDQ&issuer=OpenGate&algorithm=SHA1&digits=6&period=30
Description of the attributes of the URL:
secret: contain the secret key to generate codes.
period: define the time of validation of the code.
digits: define the length of the code generated.
algorithm: define the Algorithm used to generate the codes.
issuer: define the subject, the name of the server.
Some applications only need the secret field, and others need all parameters.
You can see the flow of this process in follow diagram