0

私の問題は、正しくないログイン資格情報を入力できるにもかかわらず、ログインに成功することです。私のコードは次のようになります。ユーザー名とパスワードを入力するためにキーボードを叩いても、ログインに成功したと表示されます。

void CreateSession()
{
    memset(&config, 0, sizeof(config));

    config.api_version = SPOTIFY_API_VERSION;
    config.cache_location = "tmp";
    config.settings_location = "tmp";
    config.application_key = g_appkey;
    config.application_key_size = g_appkey_size;
    config.user_agent = "SpotifyTest";

    error = sp_session_create(&config, &session);
    qDebug() << "1";
    if (SP_ERROR_OK != error)
    {
        qDebug() << "failed to create session: " << sp_error_message(error);
        return;
    }
}

void Login(char* username, char* password)
{

    char *blob = NULL;
    if(session == NULL)
    { 
        CreateSession();
        qDebug() << "Session Created";
    }
    error = sp_session_login(session, username, password, 1, blob);
    if (SP_ERROR_OK != error)
    {
        qDebug() << "failed to log in to Spotify: " << sp_error_message(error);
        sp_session_release(session);
    }
    else
    {
        qDebug() << "Successful Login";
        QString user_name = sp_session_user_name(session);
        qDebug() << user_name;
    }
}
4

1 に答える 1