mirror of
https://github.com/Sarsoo/Spotify.NET.git
synced 2024-12-24 15:06:26 +00:00
Removed wrong factory
This commit is contained in:
parent
417869548a
commit
0cefd0ac13
@ -1,42 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Threading;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using SpotifyAPI.Web.Enums;
|
|
||||||
using SpotifyAPI.Web.Models;
|
|
||||||
|
|
||||||
namespace SpotifyAPI.Web.Auth.Factories
|
|
||||||
{
|
|
||||||
public class CredentialWebFactory
|
|
||||||
{
|
|
||||||
private readonly string _secretId;
|
|
||||||
private readonly string _clientId;
|
|
||||||
private readonly Scope _scope;
|
|
||||||
|
|
||||||
public CredentialWebFactory(string secretId, string clientId, Scope scope)
|
|
||||||
{
|
|
||||||
_secretId = secretId;
|
|
||||||
_clientId = clientId;
|
|
||||||
_scope = scope;
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task<SpotifyWebAPI> GetWebApi()
|
|
||||||
{
|
|
||||||
var authentication = new ClientCredentialsAuth()
|
|
||||||
{
|
|
||||||
ClientId = _clientId,
|
|
||||||
Scope = _scope,
|
|
||||||
ClientSecret = _secretId
|
|
||||||
};
|
|
||||||
|
|
||||||
AutoResetEvent authenticationWaitFlag = new AutoResetEvent(false);
|
|
||||||
SpotifyWebAPI spotifyWebApi = null;
|
|
||||||
|
|
||||||
Token token = await authentication.DoAuthAsync();
|
|
||||||
|
|
||||||
if(token.Error != null)
|
|
||||||
throw new SpotifyWebApiException(token.Error);
|
|
||||||
|
|
||||||
return Task.FromResult(spotifyWebApi);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user