first commit -push
This commit is contained in:
23
RobotNet.RobotManager/HubClients/OpenIddictHubClient.cs
Normal file
23
RobotNet.RobotManager/HubClients/OpenIddictHubClient.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using OpenIddict.Client;
|
||||
using RobotNet.Clients;
|
||||
|
||||
namespace RobotNet.RobotManager.HubClients;
|
||||
|
||||
public class OpenIddictHubClient(string url, OpenIddictClientService openIddictClient, string[] scopes) : HubClient(new Uri(url),
|
||||
async () =>
|
||||
{
|
||||
var result = await openIddictClient.AuthenticateWithClientCredentialsAsync(new()
|
||||
{
|
||||
Scopes = [.. scopes],
|
||||
});
|
||||
if (result == null || result.AccessToken == null || result.AccessTokenExpirationDate == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
else
|
||||
{
|
||||
return result.AccessToken;
|
||||
}
|
||||
})
|
||||
{
|
||||
}
|
||||
Reference in New Issue
Block a user