public virtual async Task <HttpResponseMessage> Login(string redirectUrl, string authorizationCode) { var googleToken = await AuthenticationService.GetGoogleToken(redirectUrl, authorizationCode); var userInfo = await AuthenticationService.GetUserInfo(googleToken.TokenType, googleToken.AccessToken); var roleId = DataBridge.GetRoleIdByAccount(userInfo.Email); if (roleId == null) { return(Request.CreateResponse( HttpStatusCode.Unauthorized, $"{userInfo.Email} has not been configured for Sheepshead.\n" + "Please contact Jacob Buysse to create your account.")); } var account = new AccountModel { Account = userInfo.Email, RoleId = roleId.Value }; var loginModel = new LoginModel { Token = AuthenticationService.CreateAuthorizationToken(account), RoleId = roleId.Value }; return(Request.CreateResponse(HttpStatusCode.OK, loginModel)); }