Method guide

YandexAuthsdk Class

Authorization class. Instance methods:

Method Description
@NonNull
public Intent createLoginIntent(
        @NonNull final YandexAuthLoginOptions loginOptions
)

Creates an Intent to start the authorization process.

loginOptions: Parameters for starting the authorization.

public YandexAuthToken extractToken(final int resultCode, @Nullable final Intent data) throws YandexAuthException 

Handles the result of the authorization.

public String getJwt(@NonNull final YandexAuthToken token) throws YandexAuthException

Gets a JSON Web Token.

Method Description
@NonNull
public Intent createLoginIntent(
        @NonNull final YandexAuthLoginOptions loginOptions
)

Creates an Intent to start the authorization process.

loginOptions: Parameters for starting the authorization.

public YandexAuthToken extractToken(final int resultCode, @Nullable final Intent data) throws YandexAuthException 

Handles the result of the authorization.

public String getJwt(@NonNull final YandexAuthToken token) throws YandexAuthException

Gets a JSON Web Token.

YandexAuthOptions Class

SDK configuration class. Instance methods:

Method Description
public YandexAuthOptions(@NonNull final Context context, final boolean loggingEnabled) 

Creates an SDK configuration. The client app ID is taken from build.gradle.

loggingEnabled: Indicates that SDK message logging is permitted.

public String clientId() 
Returns the ID of the client app.
public boolean isLoggingEnabled() 
Returns a label indicating that SDK message logging is permitted.
Method Description
public YandexAuthOptions(@NonNull final Context context, final boolean loggingEnabled) 

Creates an SDK configuration. The client app ID is taken from build.gradle.

loggingEnabled: Indicates that SDK message logging is permitted.

public String clientId() 
Returns the ID of the client app.
public boolean isLoggingEnabled() 
Returns a label indicating that SDK message logging is permitted.

YandexAuthLoginOptions Class

An authorization parameters class. You don't need to use class instances directly: instead, create them using YandexAuthLoginOptions.Builder.build() and then transfer them to createLoginIntent without any changes.

YandexAuthLoginOptions.Builder Class

A class for creating sets of authorization parameters. After creating an instance of this class, set the authorization parameters and create an YandexAuthLoginOptions instance.

Instance methods:

Method Description
public setScopes(List<String> scopes) 

Sets the scopes to grant access to.

public setUid(Long uid)

Sets the ID of the user who is logging in (optional).

uid: User ID. Used to open the authorization screen with user data. You can get the ID value by requesting user information.

public setLoginHint(String loginHint) 

Sets a pre-filled login for authorization if the device does not have an account with the user ID sent to UID (optional).

loginHint: User login. Inserted into the authorization form if the device doesn't have an account with the user ID set using setUid (or if the UID is not set).

public setForceConfirm(Boolean isForceConfirm)

Indicates that the access confirmation screen should always be displayed, regardless of whether the user has previously granted access (optional).

isForceConfirm: If sent with the value true, the access confirmation screen will always be displayed.

public YandexAuthLoginOptions build() 
Creates an instance of the YandexAuthLoginOptions class. Before calling build(), set the necessary authorization parameters using the methods above.
Method Description
public setScopes(List<String> scopes) 

Sets the scopes to grant access to.

public setUid(Long uid)

Sets the ID of the user who is logging in (optional).

uid: User ID. Used to open the authorization screen with user data. You can get the ID value by requesting user information.

public setLoginHint(String loginHint) 

Sets a pre-filled login for authorization if the device does not have an account with the user ID sent to UID (optional).

loginHint: User login. Inserted into the authorization form if the device doesn't have an account with the user ID set using setUid (or if the UID is not set).

public setForceConfirm(Boolean isForceConfirm)

Indicates that the access confirmation screen should always be displayed, regardless of whether the user has previously granted access (optional).

isForceConfirm: If sent with the value true, the access confirmation screen will always be displayed.

public YandexAuthLoginOptions build() 
Creates an instance of the YandexAuthLoginOptions class. Before calling build(), set the necessary authorization parameters using the methods above.

YandexAuthToken Class

A class that the SDK returns after successful authorization. Instance methods:

Method Description
public YandexAuthToken(@NonNull final String value, final long expiresIn)
Creates a token containing the token value and lifetime.
public String getValue()
Returns the value of the token.
public long expiresIn()
Returns the lifetime of the token.
Method Description
public YandexAuthToken(@NonNull final String value, final long expiresIn)
Creates a token containing the token value and lifetime.
public String getValue()
Returns the value of the token.
public long expiresIn()
Returns the lifetime of the token.