You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20 lines
653 B
C#

using Newtonsoft.Json;
namespace NPin.Framework.AspNetCore.Authentication.OAuth;
public class AuthenticationErrCodeModel
{
[JsonProperty(PropertyName = "error")] public string Error { get; set; }
[JsonProperty(PropertyName = "error_description")]
public string ErrorDescription { get; set; }
public static void VerifyErrResponse(string content)
{
var model = JsonConvert.DeserializeObject<AuthenticationErrCodeModel>(content);
if (model.Error != null)
{
throw new Exception($"第三方授权返回错误 错误码 [{model.Error}] 错误详情 [{model.ErrorDescription}]");
}
}
}