diff --git a/samples/05_simple_blazor_discord_login/Pages/Index.razor.cs b/samples/05_simple_blazor_discord_login/Pages/Index.razor.cs index 3b4211a69..9e4fbc0ef 100644 --- a/samples/05_simple_blazor_discord_login/Pages/Index.razor.cs +++ b/samples/05_simple_blazor_discord_login/Pages/Index.razor.cs @@ -39,14 +39,14 @@ namespace _05_simple_blazor_discord_login.Pages } if (QueryHelpers.ParseQuery(uri.Query.TrimStart('?')).TryGetValue("code", out var code)) { - RestToken = await DiscordRestClient.GetTokenAsync(TokenType.Code, code, navigationManager.BaseUri, new List { "identify" }); //this can give you an exception if the token is expired! + RestToken = await DiscordRestClient.GetTokenAsync(TokenType.Code, code, new List { "identify" }); //this can give you an exception if the token is expired! await DiscordRestClient.LoginAsync(TokenType.Bearer, RestToken.Token); User = DiscordRestClient.CurrentUser; StateHasChanged(); } if (QueryHelpers.ParseQuery(uri.Query.TrimStart('?')).TryGetValue("refresh_token", out var refreshToken)) { - RestToken = await DiscordRestClient.GetTokenAsync(TokenType.Refresh, refreshToken, navigationManager.BaseUri, new List { "identify" }); //this can give you an exception if the token is expired! + RestToken = await DiscordRestClient.GetTokenAsync(TokenType.Refresh, refreshToken, new List { "identify" }); //this can give you an exception if the token is expired! await DiscordRestClient.LoginAsync(TokenType.Bearer, RestToken.Token); User = DiscordRestClient.CurrentUser; StateHasChanged(); diff --git a/src/Discord.Net.Rest/ClientHelper.cs b/src/Discord.Net.Rest/ClientHelper.cs index 3add70d78..7e3c7920f 100644 --- a/src/Discord.Net.Rest/ClientHelper.cs +++ b/src/Discord.Net.Rest/ClientHelper.cs @@ -16,9 +16,9 @@ namespace Discord.Rest var model = await client.ApiClient.GetMyApplicationAsync(options).ConfigureAwait(false); return RestApplication.Create(client, model); } - public static async Task GetTokenAsync(BaseDiscordClient client, TokenType tokenType, string token, string redirectUrl, IEnumerable scopes, RequestOptions options) + public static async Task GetTokenAsync(BaseDiscordClient client, TokenType tokenType, string token, IEnumerable scopes, RequestOptions options) { - var model = await client.ApiClient.GetTokenAsync(tokenType, token, redirectUrl, scopes, options).ConfigureAwait(false); + var model = await client.ApiClient.GetTokenAsync(tokenType, token, scopes, options).ConfigureAwait(false); return RestToken.Create(client, model); } diff --git a/src/Discord.Net.Rest/DiscordRestApiClient.cs b/src/Discord.Net.Rest/DiscordRestApiClient.cs index ea83d59eb..22ced63a7 100644 --- a/src/Discord.Net.Rest/DiscordRestApiClient.cs +++ b/src/Discord.Net.Rest/DiscordRestApiClient.cs @@ -318,7 +318,7 @@ namespace Discord.API /// The scopes requested. /// /// Returns with the information about the retrieved token. - public async Task GetTokenAsync(TokenType tokenType, string token, string redirectUrl, IEnumerable scopes, RequestOptions options = null) + public async Task GetTokenAsync(TokenType tokenType, string token, IEnumerable scopes, RequestOptions options = null) { Preconditions.NotNull(token, nameof(token)); options = RequestOptions.CreateOrClone(options); @@ -335,7 +335,6 @@ namespace Discord.API new KeyValuePair("client_secret", ClientSecret), new KeyValuePair("grant_type", "authorization_code"), new KeyValuePair("code", token), - new KeyValuePair("redirect_uri", redirectUrl), new KeyValuePair("scope", string.Join(" ", scopes)) }; @@ -351,7 +350,6 @@ namespace Discord.API new KeyValuePair("client_secret", ClientSecret), new KeyValuePair("grant_type", "refresh_token"), new KeyValuePair("refresh_token", token), - new KeyValuePair("redirect_uri", redirectUrl), new KeyValuePair("scope", string.Join(" ", scopes)) }; diff --git a/src/Discord.Net.Rest/DiscordRestClient.cs b/src/Discord.Net.Rest/DiscordRestClient.cs index a4c4b18b2..e27ed80fd 100644 --- a/src/Discord.Net.Rest/DiscordRestClient.cs +++ b/src/Discord.Net.Rest/DiscordRestClient.cs @@ -62,9 +62,9 @@ namespace Discord.Rest { return _applicationInfo ?? (_applicationInfo = await ClientHelper.GetApplicationInfoAsync(this, options).ConfigureAwait(false)); } - public async Task GetTokenAsync(TokenType tokenType, string token, string redirectUrl, IEnumerable scopes, RequestOptions options = null) + public async Task GetTokenAsync(TokenType tokenType, string token, IEnumerable scopes, RequestOptions options = null) { - return await ClientHelper.GetTokenAsync(this, tokenType, token, redirectUrl, scopes, options); + return await ClientHelper.GetTokenAsync(this, tokenType, token, scopes, options); } public Task GetChannelAsync(ulong id, RequestOptions options = null)