You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey there, I am currently playing with the api. Everything runs fine when i use ResponseType.Token for the LoginRequest. But for my future project i need code authorization. When i copy together the code from the examples in the documentation i get the error response "{"error":"invalid_grant","error_description":"Invalid authorization code"}". My granted code starts with "AQBe7POyLUpgMgMHAnh" is 232 characters long and contains several hyphens and underscores. At least the format seems right to me. I really dont know why the api grants a authorization code if the contained information is wrong. I double checked the parameter parsing. The literal from the url lands in my code correctly and is passed to the api completely. Am i missing a step? Here is my code. It runs within a razor-page in a blazor server app.
protected override async Task OnInitializedAsync()
{
var query = HttpUtility.ParseQueryString(new Uri(_navManager.Uri).Query);
var code = query.Get("code");
if (code == null)
{
var loginRequest = new LoginRequest(_redirectUri, _clientId, LoginRequest.ResponseType.Code)
{
Scope = new[] { Scopes.PlaylistReadPrivate, Scopes.PlaylistReadCollaborative }
};
_authUri = loginRequest.ToUri();
return;
}
var response = await new OAuthClient().RequestToken(new AuthorizationCodeTokenRequest(_clientId, _clientSecret, code, _redirectUri));
_spotify = new SpotifyClient(response.AccessToken);
}
I don't know if I am encountering a bug or if I am on a wrong path. My Project is set to .net8 and the API is on Version 7.2.1.
Hopefully someone can help me. I would be very grateful
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Hey there, I am currently playing with the api. Everything runs fine when i use ResponseType.Token for the LoginRequest. But for my future project i need code authorization. When i copy together the code from the examples in the documentation i get the error response "{"error":"invalid_grant","error_description":"Invalid authorization code"}". My granted code starts with "AQBe7POyLUpgMgMHAnh" is 232 characters long and contains several hyphens and underscores. At least the format seems right to me. I really dont know why the api grants a authorization code if the contained information is wrong. I double checked the parameter parsing. The literal from the url lands in my code correctly and is passed to the api completely. Am i missing a step? Here is my code. It runs within a razor-page in a blazor server app.
I don't know if I am encountering a bug or if I am on a wrong path. My Project is set to .net8 and the API is on Version 7.2.1.
Hopefully someone can help me. I would be very grateful
All reactions