Skip to content

Commit

Permalink
Fix #11, modify #12 (re-push)
Browse files Browse the repository at this point in the history
  • Loading branch information
Asteriskx committed Jul 8, 2023
1 parent 10f3fb0 commit 5f4f1e4
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Sagiri/Services/Spotify/Auth/SpotifyAuthenticator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ private async Task<bool> _PreAuthentication()
var request = new ClientCredentialsRequest(_SpotifyCredentialConfig.ClientId, _SpotifyCredentialConfig.ClientSecret);
var response = await new OAuthClient(config).RequestToken(request);

_SpotifyCredentialConfig.AccessToken ??= response.AccessToken;
//_SpotifyCredentialConfig.AccessToken ??= response.AccessToken;
_SpotifyCredentialConfig.CreatedAt = response.CreatedAt;
_SpotifyCredentialConfig.IsExpired = response.IsExpired;

Expand Down
21 changes: 20 additions & 1 deletion Sagiri/Util/Configuration/SpotifyCredentialConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,33 @@ public class SpotifyCredentialConfig
{
#region Properties

/// <summary>
/// client_id
/// </summary>
[JsonProperty("client_id")]
public string ClientId { get; set; }

/// <summary>
/// client_secret
/// </summary>
[JsonProperty("client_secret")]
public string ClientSecret { get; set; }

/// <summary>
/// access_token(not used)
/// </summary>
[JsonProperty("access_token")]
public string AccessToken { get; set; }

/// <summary>
/// created_at
/// </summary>
[JsonProperty("created_at")]
public DateTime CreatedAt { get; set; }

/// <summary>
/// is_expired
/// </summary>
[JsonProperty("is_expired")]
public bool IsExpired { get; set; }

Expand All @@ -38,7 +57,7 @@ public override bool IsNullOrEmpty()
{
if (string.IsNullOrEmpty(this.ClientId)) return true;
if (string.IsNullOrEmpty(this.ClientSecret)) return true;
if (string.IsNullOrEmpty(this.AccessToken)) return true;
//if (string.IsNullOrEmpty(this.AccessToken)) return true;
return false;
}

Expand Down
3 changes: 0 additions & 3 deletions SagiriUI/Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@
using System.Collections.Generic;
using System.IO;
using System.Threading.Tasks;
using System.Diagnostics.CodeAnalysis;
using System.Drawing.Imaging;
using System.Windows.Interop;

namespace SagiriUI
{
Expand Down

0 comments on commit 5f4f1e4

Please sign in to comment.