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
| Name | Type | Required | Description |
|---|---|---|---|
PhoneNumber | string | yes | Phone number in the international format |
PhoneCodeHash | string | yes | SMS-message ID, obtained from auth.sendCode |
PhoneCode | string | — | Valid numerical code from the SMS-message |
EmailVerification | EmailVerificationClass | — | Email verification code or token |
Returns
Possible errors
| Code | Type | Description |
|---|---|---|
| 500 | AUTH_RESTART | Restart the authorization process. |
| 400 | PHONE_CODE_EMPTY | phone_code is missing. |
| 400 | PHONE_CODE_EXPIRED | The phone code you provided has expired. |
| 400 | PHONE_CODE_INVALID | The provided phone code is invalid. |
| 406 | PHONE_NUMBER_INVALID | The phone number is invalid. |
| 400 | PHONE_NUMBER_UNOCCUPIED | The phone number is not yet being used. |
| 500 | SIGN_IN_FAILED | Failure while signing in. |
| 406 | UPDATE_APP_TO_LOGIN | Please update your client to login. |
References
- Official documentation
- Generated Go reference
- TL definition:
auth.signIn#8d52a951