Method guide
YandexAuthsdk Class
Authorization class.
Methods
-
Creating an
Intentfor starting the authorization process.@NonNull public Intent createLoginIntent( @NonNull final YandexAuthLoginOptions loginOptions )loginOptions— parameters for starting the authorization.
-
Processing the authorization result.
public YandexAuthToken extractToken(final int resultCode, @Nullable final Intent data) throws YandexAuthException
Description:
-
Obtaining a JSON Web Token.
public String getJwt(@NonNull final YandexAuthToken token) throws YandexAuthException
YandexAuthOptions Class
The SDK Yandex ID configuration class.
Methods
-
Creating a SDK Yandex ID configuration. The client app ID is taken from
build.gradle.public YandexAuthOptions(@NonNull final Context context, final boolean loggingEnabled)loggingEnabledis a flag indicating that logging messages from SDK Yandex ID is allowed.
-
Getting the app ID.
public String clientId() -
Getting the flag indicating that logging messages from SDK Yandex ID is allowed.
public boolean isLoggingEnabled()
YandexAuthLoginOptions Class
An authorization parameters class. You don't need to directly use class instances: create them using YandexAuthLoginOptions.Builder.build() and pass them to the createLoginIntent method without changes.
YandexAuthLoginOptions.Builder Class
A class for creating sets of authorization parameters. After creating an instance of this class, you need to set the authorization parameters and build an instance of YandexAuthLoginOptions.
Methods
-
Creating an instance of the
YandexAuthLoginOptionsclass. Before
callingbuild()set the appropriate authorization parameters using the
methods listed above.public YandexAuthLoginOptions build() -
Setting the permissions that should be obtained.
public setScopes(List<String> scopes) -
Setting the user authorization mode.
public setLoginType(LoginType.<authorization mode>).build()-
NATIVE— A Yandex app that supports authorization is used. Here are the apps supporting it on devices running Android 11 or higher:- Yandex Browser
- Yandex Start
- Yandex with Alice
- Yandex Go
- Yandex Music
- Yandex Maps
- Yandex Eats
- Yandex Mail
- Yandex Disk
If no app from the list is installed on the device, the Chrome browser opens during the authorization. If Chrome isn't installed on the device, a WebView opens.
-
BROWSER— the Chrome browser is used. If Chrome isn't installed on the device, a WebView opens. -
WEBVIEW— WebView is used.
-
YandexAuthToken Class
The class that SDK Yandex ID returns after a successful authorization.
Methods
-
Creating a token and getting information about its value, type, and lifetime.
public YandexAuthToken(@NonNull final String value, final long expiresIn) -
Getting the token value.
public String getValue() -
Getting the token lifetime.
public long expiresIn()