Q:

Compile Error While Assigning Void Function to Auth Event

I am building an application that needs Spotify to authenticate a user using ImplicitGrantAuth. I have set up my application on Spotify's dev and have a ClientID. I am using JohnnyCrazy/SpotifyAPI-NET for this application.

API documentation of Implicit Grant Auth can be found
here.
Spotify's documentation of Implicit Grant Flow can be found
here.
The original class for ImplicitGrantAuth can be found
here.

Code snippet:
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
}

Compile Error:

No overload for 'auth_OnResponseReceivedEvent' matches delegate 'SpotifyAPI.Web.Auth.ImplicitGrantAuth.OnResponseReceived'

I am not sure if I am overlooking something really simple or if I need to add something in particular. I am also pretty new to using event handlers.

A:

You have too many parameters in your auth_OnResponseReceivedEvent method. There is no string state parameter in the OnResponseReceived delegate:
public delegate void OnResponseReceived(Token token, String error);

public event OnResponseReceived OnResponseReceivedEvent;

