Authentication > Auth > authLogin
Commerce APIAuthenticationAuthauthLogin
authLogin
POST:auth/login.json

Description

Given email and a password, retrieve a JWT (json web token) that gives you access to restricted API endpoints.

If user enabled two-factor authorization, an attempt to login without two_factor_code set (and given that email and password are correct) will return a response with empty token field and two_factor_enabled field set to true. Implying that you should display additional UI and ask for two_factor_code. Once you provide all three fields (email, password and two_factor_code) and they are valid, the API will return you a proper JWT.

See also: Authentication.

Topic: Auth

Arguments

data: UserLogin!

Main argument for mutations.


Data Argument Fields

email: String

Email of the user

Example: "no+spam@mail.com"

Valid when: email is not empty


fingerprint: String

Your device fingerprint (internal, temporary, used for debug purposes)


oauth_code: String

OAuth2 authorization code provided by the provider


oauth_provider: OAuth2Provider

OAuth2 provider used for registering this account


password: String

The user's password

Example: "34hb5kj3h45k3"


timezone_hint: String

Timezone hint. Used as a hint when implicitly creating the user.

Example: "(GMT-05:00) Eastern Time"

Valid when: timezone_hint's length doesn't exceed 50 characters


tos_agree: Boolean

It has to be set to true and signifies that you agree with Lana TOS

Example: true


trusted: Boolean

Whether to mark device as trusted upon successful login

Example: true


two_factor_code: String

Two factor auth verification code

Example: "545346"


Result

TokenAndUserID

Preview (typescript)

Loading module