addMappingForcibly
Forcibly trying to map the currently authenticated user identifier of Gamebase with the credential of external authentication provider.
Example Usage:
public void addMappingForciblyFacebook(final Activity activity) {
Gamebase.addMapping(activity, AuthProvider.FACEBOOK, null, new GamebaseDataCallback<AuthToken>() {
@Override
public void onCallback(AuthToken result, GamebaseException exception) {
// Add Mapping Success.
if (Gamebase.isSuccess(exception)) {
...
}
// If you got this error code(AUTH_ADD_MAPPING_ALREADY_MAPPED_TO_OTHER_MEMBER)
// that means this user already has another account of the idP.
// You can call this method, Gamebase.addMappingForcibly() which can try to map forcibly with the idP.
if (exception.getCode() == GamebaseError.AUTH_ADD_MAPPING_ALREADY_MAPPED_TO_OTHER_MEMBER) {
// Before calling the mapping forcibly api,
// You should get this ForcingMappingTicket for this method parameter.
final ForcingMappingTicket ticket = ForcingMappingTicket.from(exception);
// Try to add mapping forcibly with the ForcingMappingTicket.
Gamebase.addMappingForcibly(activity, ticket, new GamebaseDataCallback<AuthToken>() {
@Override
public void onCallback(AuthToken data, GamebaseException addMappingForciblyException) {
if (Gamebase.isSuccess(addMappingForciblyException)) {
// Add Mapping Forcibly Success.
Log.d(TAG, "Add Mapping Forcibly successful");
String userId = Gamebase.getUserID();
return;
}
// Add Mapping Forcibly Failed.
// Check the error code and handle the error appropriately.
...
}
}
} else {
// Add Mapping Failed.
// Check the error code and handle the error appropriately.
}
}
});
}
Parameters
The activity which is starting the login process.
The mapping information which is necessary to map forcibly with the provider that is already mapped with another account.
Resume mapping result callback, returns the authentication token as a result of mapping.
See also
Forcibly trying to map the currently authenticated user identifier of Gamebase with the credential of external authentication provider.
Example Usage:
public void addMappingForciblyFacebook(final Activity activity) {
Gamebase.addMapping(activity, AuthProvider.FACEBOOK, null, new GamebaseDataCallback<AuthToken>() {
@Override
public void onCallback(AuthToken result, GamebaseException exception) {
// Add Mapping Success.
if (Gamebase.isSuccess(exception)) {
...
}
// If you got this error code(AUTH_ADD_MAPPING_ALREADY_MAPPED_TO_OTHER_MEMBER) that means
// this user already has another account of the AuthProvider.XXX),
// You can call this method, Gamebase.addMappingForcibly()
// which can try to map forcibly with the AuthProvider.XXX.
if (exception.getCode() == GamebaseError.AUTH_ADD_MAPPING_ALREADY_MAPPED_TO_OTHER_MEMBER) {
// Before calling the mapping forcibly api,
// You should get this ForcingMappingTicket and ForcingMappingKey string for this method parameter.
final ForcingMappingTicket ticket = ForcingMappingTicket.from(exception);
final String forcingMappingKey = ticket.forcingMappingKey;
// Try to add mapping forcibly with the ForcingMappingKey.
Gamebase.addMappingForcibly(activity, AuthProvider.FACEBOOK, forcingMappingKey, null, new GamebaseDataCallback<AuthToken>() {
@Override
public void onCallback(AuthToken data, GamebaseException addMappingForciblyException) {
if (Gamebase.isSuccess(addMappingForciblyException)) {
// Add Mapping Forcibly Success.
Log.d(TAG, "Add Mapping Forcibly successful");
String userId = Gamebase.getUserID();
return;
}
// Add Mapping Forcibly Failed.
// Check the error code and handle the error appropriately.
}
}
} else {
// Add Mapping Failed.
// Check the error code and handle the error appropriately.
}
}
});
}
Parameters
The activity which is starting the login process.
The providerName which is authentication provider.
The key string which is necessary to map forcibly with the provider that is already mapped with another account.
Mapping Forcibly result callback, returns the authentication token as a result of mapping.
See also
Forcibly trying to map the currently authenticated user identifier of Gamebase with the credential of external authentication provider.
Example Usage:
public void addMappingForciblyFacebook(final Activity activity, final Map<String, Object> additionalInfo) {
Gamebase.addMapping(activity, AuthProvider.FACEBOOK, additionalInfo, new GamebaseDataCallback<AuthToken>() {
@Override
public void onCallback(AuthToken result, GamebaseException exception) {
// Add Mapping Success.
if (Gamebase.isSuccess(exception)) {
...
}
// If you got this error code(AUTH_ADD_MAPPING_ALREADY_MAPPED_TO_OTHER_MEMBER) that means
// this user already has another account of the AuthProvider.XXX),
// You can call this method, Gamebase.addMappingForcibly()
// which can try to map forcibly with the AuthProvider.XXX.
if (exception.getCode() == GamebaseError.AUTH_ADD_MAPPING_ALREADY_MAPPED_TO_OTHER_MEMBER) {
// Before calling the mapping forcibly api,
// You should get this ForcingMappingTicket and ForcingMappingKey string for this method parameter.
final ForcingMappingTicket ticket = ForcingMappingTicket.from(exception);
final String forcingMappingKey = ticket.forcingMappingKey;
// Try to add mapping forcibly with the ForcingMappingKey.
Gamebase.addMappingForcibly(activity, AuthProvider.FACEBOOK, forcingMappingKey, additionalInfo, new GamebaseDataCallback<AuthToken>() {
@Override
public void onCallback(AuthToken data, GamebaseException addMappingForciblyException) {
if (Gamebase.isSuccess(addMappingForciblyException)) {
// Add Mapping Forcibly Success.
Log.d(TAG, "Add Mapping Forcibly successful");
String userId = Gamebase.getUserID();
return;
}
// Add Mapping Forcibly Failed.
// Check the error code and handle the error appropriately.
}
}
} else {
// Add Mapping Failed.
// Check the error code and handle the error appropriately.
}
}
});
}
Parameters
The activity which is starting the login process.
The providerName which is authentication provider.
The key string which is necessary to map forcibly with the provider that is already mapped with another account.
The additionalInfo which is additional information using for mapping.
Mapping Forcibly result callback, returns the authentication token as a result of mapping.
See also
Forcibly trying to map the currently authenticated user identifier of Gamebase with the credential of external authentication provider.
Example Usage:
public void addMappingForciblyFacebook(final Activity activity, final String facebookAccessToken) {
final Map<String, Object> credentialInfo = new HashMap<>();
credentialInfo.put(AuthProviderCredentialConstants.PROVIDER_NAME, AuthProvider.FACEBOOK);
credentialInfo.put(AuthProviderCredentialConstants.ACCESS_TOKEN, facebookAccessToken);
Gamebase.addMapping(activity, credentialInfo, new GamebaseDataCallback<AuthToken>() {
@Override
public void onCallback(AuthToken result, GamebaseException exception) {
// Add Mapping Success.
if (Gamebase.isSuccess(exception)) {
...
}
// If you got this error code(AUTH_ADD_MAPPING_ALREADY_MAPPED_TO_OTHER_MEMBER)
// that means this user already has another account of the AuthProvider.XXX),
// You can call this method, Gamebase.addMappingForcibly()
// which can try to map forcibly with the AuthProvider.XXX.
if (exception.getCode() == GamebaseError.AUTH_ADD_MAPPING_ALREADY_MAPPED_TO_OTHER_MEMBER) {
// Before calling the mapping forcibly api,
// You should get this ForcingMappingTicket and ForcingMappingKey string for this method parameter.
final ForcingMappingTicket ticket = ForcingMappingTicket.from(exception);
final String forcingMappingKey = ticket.forcingMappingKey;
// Try to add mapping forcibly with the ForcingMappingKey.
Gamebase.addMappingForcibly(activity, credentialInfo, forcingMappingKey, new GamebaseDataCallback<AuthToken>() {
@Override
public void onCallback(AuthToken data, GamebaseException addMappingForciblyException) {
if (Gamebase.isSuccess(addMappingForciblyException)) {
// Add Mapping Forcibly Success.
Log.d(TAG, "Add Mapping Forcibly successful");
String userId = Gamebase.getUserID();
return;
}
// Add Mapping Forcibly Failed.
// Check the error code and handle the error appropriately.
...
}
}
} else {
// Add Mapping Failed.
// Check the error code and handle the error appropriately.
...
}
}
});
}
Parameters
The activity which is starting the login process.
The credentialInfo which is credential of authentication provider.
The key string which is necessary to map forcibly with the provider that is already mapped with another account.
Mapping Forcibly result callback, returns the authentication token as a result of mapping.