The package com.github.badoualy.telegram.mtproto.auth contains classes needed to do all the work to create a new authorization key following Telegram's documentation specifications.

To create a new authorization key, you can just call:

DataCenter prodDC4 = new DataCenter("149.154.167.91", 443);
AuthResult authResult = AuthKeyCreation.createAuthKey(prodDC4);

// AuthResult contains the active connection, close it if you're not using it :)
if (authResult != null)
    authResult.getConnection().close();

Here is the list of production datacenters:

DataCenter prodDC1 = new DataCenter("149.154.175.50", 443);
DataCenter prodDC2 = new DataCenter("149.154.167.51", 443);
DataCenter prodDC3 = new DataCenter("149.154.175.100", 443);
DataCenter prodDC4 = new DataCenter("149.154.167.91", 443);
DataCenter prodDC5 = new DataCenter("91.108.56.165", 443);

📘

Api module

If you're using the whole library, don't hardcode those values, they're already present in the Kotlogram class. See the module's documentation for more details.


Did this page help you?