You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
428 B
21 lines
428 B
3 years ago
|
package qrlogin
|
||
|
|
||
|
import (
|
||
|
"context"
|
||
|
|
||
|
"github.com/go-faster/errors"
|
||
|
|
||
|
"github.com/gotd/td/tg"
|
||
|
)
|
||
|
|
||
|
// AcceptQR accepts given token.
|
||
|
//
|
||
|
// See https://core.telegram.org/api/qr-login#accepting-a-login-token.
|
||
|
func AcceptQR(ctx context.Context, raw *tg.Client, t Token) (*tg.Authorization, error) {
|
||
|
auth, err := raw.AuthAcceptLoginToken(ctx, t.token)
|
||
|
if err != nil {
|
||
|
return nil, errors.Wrap(err, "accept")
|
||
|
}
|
||
|
return auth, nil
|
||
|
}
|