---
metadata:
  - name: generator
    content: Diplodoc Platform v5.44.0
alternate:
  - https://yandex.com/dev/id/doc/en/mobileauthsdk/android/archive/2.5.1/sdk-android-methods.md
  - https://yandex.com/dev/id/doc/ru/mobileauthsdk/android/archive/2.5.1/sdk-android-methods.md
---
> **Documentation Index:** Fetch the complete configuration index at https://yandex.com/dev/id/doc/en/llms.txt

# Method guide

## YandexAuthsdk Class {#yaloginsdk}

Authorization class. 

### Methods {#yaloginsdk-methods}

* Creating an `Intent` for starting the authorization process.

   ```java
   @NonNull
   public Intent createLoginIntent(
         @NonNull final YandexAuthLoginOptions loginOptions
   )
   ```

   * `loginOptions` — parameters for starting the authorization.


* Processing the authorization result.

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

**Description:** 

* Obtaining a [JSON Web Token](https://yandex.com/dev/id/doc/en/tokens/jwt.md).

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

## YandexAuthOptions Class {#yaloginsdkconfig}

The SDK Yandex ID configuration class. 

### Methods {#yaloginsdkconfig-methods}

* Creating a SDK Yandex ID configuration. The client app ID is taken from `build.gradle`.

   ```java
   public YandexAuthOptions(@NonNull final Context context, final boolean loggingEnabled) 
   ```

   * `loggingEnabled` is a flag indicating that logging messages from SDK Yandex ID is allowed.

* Getting the [app ID](https://yandex.com/dev/id/doc/en/register-client.md#app-params).

   ```java
   public String clientId() 
   ```

* Getting the flag indicating that logging messages from SDK Yandex ID is allowed.

   ```java
   public boolean isLoggingEnabled() 
   ```

## YandexAuthLoginOptions Class {#yandexauthloginoptions}

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](#yaloginsdk) method without changes.

## YandexAuthLoginOptions.Builder Class {#yandexauthloginoptions-builder}

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 {#yandexauthloginoptions-builder-methods}

* Creating an instance of the `YandexAuthLoginOptions` class. Before
 calling `build()` set the appropriate authorization parameters using the
 methods listed above.

   ```java
   public YandexAuthLoginOptions build() 
   ```

* Setting the permissions that should be obtained.

   ```java
   public setScopes(List<String> scopes) 
   ```

* Setting the user authorization mode.

   ```java
   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](https://developer.android.com/develop/ui/views/layout/webapps/webview) opens.

   * `BROWSER` — the Chrome browser is used. If Chrome isn't installed on the device, a [WebView](https://developer.android.com/develop/ui/views/layout/webapps/webview) opens.

   * `WEBVIEW` — [WebView](https://developer.android.com/develop/ui/views/layout/webapps/webview) is used.

## YandexAuthToken Class {#token}

The class that SDK Yandex ID returns after a successful authorization. 

### Methods {#token-methods}

* Creating a token and getting information about its value, type, and lifetime.

   ```java
   public YandexAuthToken(@NonNull final String value, final long expiresIn)
   ```

* Getting the token value.

   ```java
   public String getValue()
   ```

* Getting the token lifetime.
   
   ```java
   public long expiresIn()
   ```
