Closed SHOEGAZEssb closed 4 years ago
Hey @coczero , I'm not sure to be honest. I do not really use this library any more. My feeling would be that maybe Last.fm have changed their API, but their documentation looks the same to me. https://www.last.fm/api/mobileauth
Does it say which parameters are missing?
Unfortunately it doesn't say which parameter is missing, at least its not visible from the LastResponse object.
Hi @coczero, I have just implemented the two missing authentication paths (Web&Desktop) here (https://github.com/inflatablefriends/lastfm/pull/155) and tested all three variants in my app. They all are working well. If you follow the documentation, it works. To help you, I need to see you code. Can you show here your code?
Hi @tolbxela,
I'm just using the LastAuth object.
var response = await _lastAuth.GetSessionTokenAsync(Username, password.Password);
if (response.Success && _lastAuth.Authenticated)
{
_messageBoxService.ShowDialog("Successfully logged in and authenticated!");
TryClose(true);
}
else
_messageBoxService.ShowDialog("Failed to log in or authenticate!");
I don't see here how did you create the _lastAuth object.
The flow should be:
var client = new LastfmClient("apikey", "apisecret");
var response = await client.Auth.GetSessionTokenAsync("username", "pass");
Unfortunately it doesn't say which parameter is missing, at least its not visible from the LastResponse object.
Can you take a look at the request returned from the Last.fm API? Adding a proxy like Fiddler or Wireshark would help you do this.
@tolbxela there's an alternate constructor on LastfmClient
that allows you to pass in the auth
object like @coczero is doing. They should be equivalent https://github.com/inflatablefriends/lastfm/blob/master/src/IF.Lastfm.Core/Api/LastfmClient.cs#L32
It's possible @coczero that your Auth object is not being created correctly but I am just guessing at that. The proxy logs from Fiddler/Wireshark should indicate which parameter is wrong (I agree it'd be useful if this were surfaced in the LastFmResponse
object)
It's possible @coczero that your Auth object is not being created correctly ...
@rikkit that could be really the reason of the "missing parameter" error
@coczero If you put the project to your VS Solution, you can debug the whole data transfer without using of any extra tools.
Sorry if you think I was repeating what you said @tolbxela, but I am aware @coczero has used this project for a while, so unless the way the auth in their app works has been changed recently, I think it's indicative that the way LastAuth
has been set up is correct (or at least correct as per documentation).
The answer will lie in the JSON sent back from Last.fm, we're agreed on that.
Sorry if you think I was repeating what you said @tolbxela
@rikkit no, I didn't mean it. :-)
@coczero Have you changed something in the app/auth recently?
@tolbxela no everything is still the same way it has been for months now. I will try to find out which parameter is missing.
I have just tested the Mobile Auth path with my current project commit (a9119588702bcf2e7bd23a4430153cc91f47e66e) and it works well with my API Key, user/pass.
You can debug the GetSessionTokenAsync() function:
@tolbxela no everything is still the same way it has been for months now. I will try to find out which parameter is missing.
Check if your Last.FM API Key still valid. They could possibly revoke them, if you do too much requests.
@tolbxela is there a convenient way to check if the key is still valid?
There was one: https://last.fm/api/accounts/ But now it looks pretty broken for me. You can try to email Last.fm about your key or just create a new API Key and test it. ;-)
I guess, you should try to debug it thoughtfully at first. :-)
I can still scrobble with that api key tho (I am still logged in), so it probably isn't the api key.
Ok so it seems like this is an oddity in my app - I just tried a very minimal example (tho with same api key) and it works there. I have to do some more investigation.
Yea, this was the result of a recent merge, basically I didn't pass the Username in lol...
Multiple users of my app have reported that the login does not work currently. I have tested and verified this behaviour. The GetSessionTokenAsync call returns a MissingParameters result. Any idea what might be up with that?
Cheers, Tim