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

MissingParameters when using GetSessionTokenAsync #156

Closed
SHOEGAZEssb opened this issue Apr 6, 2020 · 18 comments
Closed

MissingParameters when using GetSessionTokenAsync #156

SHOEGAZEssb opened this issue Apr 6, 2020 · 18 comments

Comments

@SHOEGAZEssb
Copy link
Contributor

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

@rikkit
Copy link
Member

rikkit commented Apr 6, 2020

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?

@SHOEGAZEssb
Copy link
Contributor Author

Unfortunately it doesn't say which parameter is missing, at least its not visible from the LastResponse object.

@tolbxela
Copy link

tolbxela commented Apr 6, 2020

Hi @coczero,
I have just implemented the two missing authentication paths (Web&Desktop) here (#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?

@SHOEGAZEssb
Copy link
Contributor Author

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!");

@tolbxela
Copy link

tolbxela commented Apr 6, 2020

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");

@rikkit
Copy link
Member

rikkit commented Apr 6, 2020

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)

@tolbxela
Copy link

tolbxela commented Apr 6, 2020

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.

@rikkit
Copy link
Member

rikkit commented Apr 6, 2020

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.

@tolbxela
Copy link

tolbxela commented Apr 6, 2020

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?

@SHOEGAZEssb
Copy link
Contributor Author

@tolbxela no everything is still the same way it has been for months now.
I will try to find out which parameter is missing.

@tolbxela
Copy link

tolbxela commented Apr 6, 2020

I have just tested the Mobile Auth path with my current project commit (a911958) and it works well with my API Key, user/pass.

You can debug the GetSessionTokenAsync() function:
image

@tolbxela
Copy link

tolbxela commented Apr 6, 2020

@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.

@SHOEGAZEssb
Copy link
Contributor Author

@tolbxela is there a convenient way to check if the key is still valid?

@tolbxela
Copy link

tolbxela commented Apr 6, 2020

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. ;-)

@tolbxela
Copy link

tolbxela commented Apr 6, 2020

I guess, you should try to debug it thoughtfully at first. :-)

@SHOEGAZEssb
Copy link
Contributor Author

I can still scrobble with that api key tho (I am still logged in), so it probably isn't the api key.

@SHOEGAZEssb
Copy link
Contributor Author

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.

@SHOEGAZEssb
Copy link
Contributor Author

Yea, this was the result of a recent merge, basically I didn't pass the Username in lol...

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

3 participants