C# 将Void函数分配给Auth事件时发生编译错误

C# 将Void函数分配给Auth事件时发生编译错误,c#,api,authentication,spotify,C#,Api,Authentication,Spotify,我正在构建一个应用程序,该应用程序需要Spotify使用隐式Grantuth对用户进行身份验证。我已经在Spotify的dev上设置了我的应用程序,并拥有一个ClientID。我正在使用JohnnyCrazy/SpotifyAPI NET用于此应用程序 可以找到隐式授权验证的API文档 Spotify的隐式拨款流文档可以找到 可以找到隐式Grantuth的原始类 代码片段: static ImplicitGrantAuth auth; static void Main(string[]

我正在构建一个应用程序,该应用程序需要Spotify使用
隐式Grantuth
对用户进行身份验证。我已经在Spotify的dev上设置了我的应用程序,并拥有一个
ClientID
。我正在使用JohnnyCrazy/SpotifyAPI NET用于此应用程序

  • 可以找到隐式授权验证的API文档

  • Spotify的隐式拨款流文档可以找到

  • 可以找到
    隐式Grantuth
    的原始类

代码片段:

static ImplicitGrantAuth auth;
static void Main(string[] args)
{
    //Create the auth object
    auth = new ImplicitGrantAuth()
    {
        //Your client Id
        ClientId = "XXXXXXXXXXXXXXXXXX", // example only
        //Set this to localhost if you want to use the built-in HTTP Server
        RedirectUri = "http://localhost",
        //How many permissions we need?
        Scope = Scope.UserReadPrivate,
    };
    //Start the internal http server
    auth.StartHttpServer();
    //When we got our response
    auth.OnResponseReceivedEvent += auth_OnResponseReceivedEvent; // <-- Error here!
    //Start
    auth.DoAuth();
}

static void auth_OnResponseReceivedEvent(Token token, string state, string error)
{
    //stop the http server
    auth.StopHttpServer();

    var spotify = new SpotifyWebAPI()
    {
        TokenType = token.TokenType,
        AccessToken = token.AccessToken
    };
    //We can now make calls with the token object
}
static implicitgrantuth auth;
静态void Main(字符串[]参数)
{
//创建auth对象
auth=新隐式Grantuth()
{
//您的客户Id
ClientId=“xxxxxxxxxxxxxxxx”//仅示例
//如果要使用内置HTTP服务器,请将其设置为localhost
重定向URI=”http://localhost",
//我们需要多少权限?
Scope=Scope.UserReadPrivate,
};
//启动内部http服务器
auth.StartHttpServer();
//当我们得到回应时

auth.OnResponseReceivedEvent+=auth\u OnResponseReceivedEvent;//您的
auth\u OnResponseReceivedEvent
方法中的参数太多。在
OnResponseReceived
委托中没有
字符串状态
参数:

public delegate void OnResponseReceived(Token token, String error);

public event OnResponseReceived OnResponseReceivedEvent;