Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error code 14 after receiving a new token #34

Open
joey-kwl opened this issue Jun 24, 2020 · 1 comment
Open

Error code 14 after receiving a new token #34

joey-kwl opened this issue Jun 24, 2020 · 1 comment

Comments

@joey-kwl
Copy link

Not sure if I did it right, but I get my token (which does work) after that I tried to update my scrobble and I get Error 14, "Unauthorized token".

lastfm.request("auth.gettoken", {
    handlers: {
        success: function(data) {
			let token = data.token;
			
			let track = {
				artist: "TWICE",
				track: "TT",
				timestamp: + new Date()
			}

			var sessions = lastfm.session({
				token: token,
				handlers: {
					success: function(session) {
						console.log(session)
						lastfm.update('nowplaying', session, { track: track } );
						lastfm.update('scrobble', session, { track: track, timestamp: + new Date() });
					},
					error: function(track, err) {
						console.log(track, err)
					},
					retrying: (retry) => {
						console.log(retry)
					}
				}
			});
			
        },
        error: function(error) {
            console.log("Error: " + error.message);
        }
    }
});
@gil
Copy link

gil commented Aug 31, 2023

After you get the token, you need to open this page on the user's browser:

http://www.last.fm/api/auth/?api_key=${apiKey}&token=${token}

You can make .update() calls only after it's authorized. You can read more about it here: https://www.last.fm/api/desktopauth

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants