addMapping

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

Mapping the currently authenticated user identifier of Gamebase with another external authentication.

Example Usage:

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

Since

Added 1.4.0.

Parameters

activity

The activity which is starting the mapping process.

providerName

The providerName which is authentication provider.

callback

Mapping result callback, returns the authentication token as a result of mapping.

See also


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

Mapping the currently authenticated user identifier of Gamebase with another external authentication.

Example Usage:

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

Since

Added 1.4.0.

Parameters

activity

The activity which is starting the mapping process.

providerName

The providerName which is authentication provider.

additionalInfo

The additionalInfo which is additional information using for mapping.

callback

Callbacks the results of mappings, returns the authentication token as a result of mappings.

See also


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

Mapping the currently authenticated user identifier of Gamebase 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.addMapping(activity, credential, new GamebaseDataCallback<AuthToken>() {
    @Override
    public void onCallback(AuthToken data, GamebaseException exception) {
        if (Gamebase.isSuccess(exception)) {
            Log.d(TAG, "Add mapping successful");
        } else {
            Log.e(TAG, "Add mapping failed");
        }
    }
});

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

Mapping result callback, returns the authentication token as a result of mapping.

See also