Skip to main content

auth.signIn

Signs in a user with a validated phone number.

func (c *Client) AuthSignIn(ctx context.Context, request *AuthSignInRequest) (AuthAuthorizationClass, error)

Calling this method

client.Run(ctx, func(ctx context.Context) error {
api := client.API()

res, err := api.AuthSignIn(ctx, &tg.AuthSignInRequest{
// see Parameters
})
if err != nil {
return err
}
_ = res // AuthAuthorizationClass
return nil
})

Parameters

NameTypeRequiredDescription
PhoneNumberstringyesPhone number in the international format
PhoneCodeHashstringyesSMS-message ID, obtained from auth.sendCode
PhoneCodestringValid numerical code from the SMS-message
EmailVerificationEmailVerificationClassEmail verification code or token

Returns

AuthAuthorizationClass

Possible errors

CodeTypeDescription
500AUTH_RESTARTRestart the authorization process.
400PHONE_CODE_EMPTYphone_code is missing.
400PHONE_CODE_EXPIREDThe phone code you provided has expired.
400PHONE_CODE_INVALIDThe provided phone code is invalid.
406PHONE_NUMBER_INVALIDThe phone number is invalid.
400PHONE_NUMBER_UNOCCUPIEDThe phone number is not yet being used.
500SIGN_IN_FAILEDFailure while signing in.
406UPDATE_APP_TO_LOGINPlease update your client to login.

References