# login

open fun login(@NonNull activity: Activity, providerName: String, @Nullable callback: GamebaseDataCallback<AuthToken>)

Logs the user in with the external authentication provider.

Example Usage:

    Gamebase.login(activity, AuthProvider.GOOGLE, new GamebaseDataCallback<AuthToken>() {
        @Override
        public void onCallback(AuthToken data, GamebaseException exception) {
            if (Gamebase.isSuccess(exception)) {
                Log.d(TAG, "Login successful");
            } else {
                Log.e(TAG, "Login failed");
            }
        }
    });

Content copied to clipboard

#### Since

Added 1.4.0.

#### Parameters

activity

The activity which is starting the login process.

providerName

The provider name witch is authentication provider.

callback

Login result callback, returns the authentication token as a result of login.

#### See also

AuthProvider
AuthToken
GamebaseDataCallback

open fun login(@NonNull activity: Activity, providerName: String, @Nullable additionalInfo: Map<String, Any>, @Nullable callback: GamebaseDataCallback<AuthToken>)

Logs the user in with the external authentication provider.

Example Usage:

    Gamebase.login(activity, AuthProvider.GOOGLE, additionalInfo, new GamebaseDataCallback<AuthToken>() {
        @Override
        public void onCallback(AuthToken data, GamebaseException exception) {
            if (Gamebase.isSuccess(exception)) {
                Log.d(TAG, "Login successful");
            } else {
                Log.e(TAG, "Login failed");
            }
        }
    });

Content copied to clipboard

#### Since

Added 1.4.0.

#### Parameters

activity

The activity which is starting the login process.

providerName

The providerName which is authentication provider.

additionalInfo

The additionalInfo which is additional information using for login.

callback

Login result callback, returns the authentication token as a result of login.

#### See also

AuthProvider
AuthToken
GamebaseDataCallback

open fun login(@NonNull activity: Activity, @NonNull credentialInfo: Map<String, Any>, @Nullable callback: GamebaseDataCallback<AuthToken>)

Logs the user in with the credential of external authentication provider.

Example Usage:

    Map<String, Object> credential = new HashMap<>();
    credential.put(AuthProviderCredentialConstants.PROVIDER_NAME, providerName);
    credential.put(AuthProviderCredentialConstants.ACCESS_TOKEN, accessToken);
    credential.put(AuthProviderCredentialConstants.ACCESS_TOKEN_SECRET, accessTokenSecret);
    Gamebase.login(activity, credential, new GamebaseDataCallback<AuthToken>() {
        @Override
        public void onCallback(AuthToken data, GamebaseException exception) {
            if (Gamebase.isSuccess(exception)) {
                Log.d(TAG, "Login successful");
            } else {
                Log.e(TAG, "Login failed");
            }
        }
    });

Content copied to clipboard

#### Since

Added 1.4.0.

#### Parameters

activity

The activity which is starting the login process.

credentialInfo

The credentialInfo which is credential of authentication provider.

callback

Login result callback, returns the authentication token as a result of login.

#### See also

AuthProvider
AuthToken
GamebaseDataCallback