Layer 231
AccountAcceptAuthorization
Sends a Telegram Passport authorization form, effectively sharing data with the service
method
Users
account.acceptAuthorization#f3ed4c73 bot_id:long scope:string public_key:string value_hashes:Vector<SecureValueHash> credentials:SecureCredentialsEncrypted = Bool;
Parameters
| Name | Type | Description |
|---|---|---|
| BotId | long | ID of the bot (service) requesting the Passport data |
| Scope | string | Telegram Passport element types requested by the service |
| PublicKey | string | Public key of the service, used to encrypt the credentials |
| ValueHashes | Vector<SecureValueHash> | Types of values sent and their hashes |
| Credentials | SecureCredentialsEncrypted | Encrypted credentials that let the service decrypt the shared values |
Returns
BoolGogram Example
// Telegram Passport: hashes and encrypted credentials are built from the authorization form ok, err := client.AccountAcceptAuthorization(543260180, `{"data":["personal_details","passport"],"v":1}`, botPublicKeyPEM, []*tg.SecureValueHash{{Type: tg.SecureValueTypePassport, Hash: passportHash}}, &tg.SecureCredentialsEncrypted{Data: credData, Hash: credHash, Secret: credSecret}) if err != nil { log.Fatal(err) } fmt.Println("passport data shared:", ok)
Possible Errors
| Code | Type | Description |
|---|---|---|
| 400 | BOT_INVALID | This is not a valid bot. |
| 400 | PUBLIC_KEY_REQUIRED | A public key is required. |