loginWithCredential method
Logs in as a user with the given credentials associated with an authentication provider.
Implementation
@deprecated
Future<CoreRealmUser?> loginWithCredential(
StitchCredential credential) async {
var result;
if (credential is AnonymousCredential) {
result = await FlutterMongoRealm.signInAnonymously();
} else if (credential is UserPasswordCredential) {
result = await FlutterMongoRealm.signInWithUsernamePassword(
credential.username,
credential.password,
);
} else if (credential is GoogleCredential2) {
try {
var authCode = credential.authCode;
result = await FlutterMongoRealm.signInWithGoogle(authCode);
} on Exception catch (e) {
print(e);
}
} else if (credential is FacebookCredential) {
result =
await FlutterMongoRealm.signInWithFacebook(credential.accessToken);
} else if (credential is CustomJwtCredential) {
result = await FlutterMongoRealm.signInWithCustomJwt(credential.token);
} else if (credential is FunctionCredential) {
final MongoDocument doc = credential.arguments;
var args = json.encode(doc.map);
result = await FlutterMongoRealm.signInWithCustomFunction(args);
} else if (credential is AppleCredential) {
result = await FlutterMongoRealm.signInWithApple(credential.idToken);
} else {
throw UnimplementedError();
}
return result;
}