Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to login offline: no such user - Spotify

Tags:

spotify

I'm trying to create a spotify application, but when doing the login I get a weird error message: *19:28:57.916 I [offline_authorizer.cpp:289] Unable to login offline: no such user

int main() {

    sp_session *sp;
    sp_error err;

    sp_session_callbacks callbacks;
    callbacks.logged_in = &logged_in;
    callbacks.notify_main_thread = &notify_main_thread;
    callbacks.music_delivery = &music_delivery;
    callbacks.metadata_updated = &metadata_updated;
    callbacks.play_token_lost = &play_token_lost;
    callbacks.log_message = &log_message;
    callbacks.end_of_track = &end_of_track;

    sp_session_config config;
    config.api_version = 10;
    config.cache_location = "/tmp/libSpotify";
    config.settings_location = "/tmp/libSpotify1";
    config.application_key = g_appkey;
    config.application_key_size = g_appkey_size;
    config.user_agent = "Name_of_client";
    config.callbacks = &callbacks;
    config.tracefile = "/tmp/trace";

    err = sp_session_create(&config, &sp);

    g_sess = sp;

    if (SP_ERROR_OK != err) {
        fprintf(stderr, "Unable to create session: %s\n",
                sp_error_message(err));
        exit(1);
    }
    sp_session_login(sp, username, password, 0);
    printf("Exiting");
    return 0;
}

I've been using the Jukebox example, but can't seem to get it to work. I can login to my account and play music on the computer using the account.

like image 427
Hiny Avatar asked Jan 01 '26 00:01

Hiny


1 Answers

You'll need to call sp_session_process_events() in your main thread's event processing loop. Found this in Connected to spotify AP, but GetConnectionState(), user not yet logged in so check that out for more details.

like image 68
chris.f.jones Avatar answered Jan 06 '26 17:01

chris.f.jones



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!