C# 将Void函数分配给Auth事件时发生编译错误
我正在构建一个应用程序,该应用程序需要Spotify使用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[]
隐式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;