1
我想爲使用firebaseauthentication.net庫的用戶登錄到Firebase的服務堆棧創建自定義憑據提供程序。我遇到的問題是,在調用認證方法後,瀏覽器一直說永久加載。這是我的代碼:使用Firebase的ServiceStack中的自定義憑據提供程序
public override bool TryAuthenticate(IServiceBase authService,string userName, string password)
{
return Authenticate(userName, password).Result;
}
private async Task<bool> Authenticate(string userName,string password)
{
provider = new FirebaseAuthProvider(new FirebaseConfig(firebaseApiKey));
try
{
auth = await provider.SignInWithEmailAndPasswordAsync(userName, password);
return auth.User != null;
}
catch(Exception e)
{
return false;
}
}
public override IHttpResult OnAuthenticated(IServiceBase authService,IAuthSession session, IAuthTokens tokens,Dictionary<string, string> authInfo)
{
session.FirstName = auth.User.DisplayName;
session.Id = auth.User.LocalId;
session.Email = auth.User.Email;
return base.OnAuthenticated(authService, session, tokens, authInfo);
}