Files
Core.Thalos.BuildingBlocks/Core.Thalos.BuildingBlocks/Helpers/GoogleAuthHelper.cs
2025-08-22 21:04:25 -06:00

32 lines
935 B
C#

using Google.Apis.Auth.OAuth2;
using Google.Apis.Oauth2.v2;
using Microsoft.Extensions.Configuration;
namespace Core.Thalos.BuildingBlocks
{
public class GoogleAuthHelper(IConfiguration config, GoogleAuthSettings googleSettings) : IGoogleAuthHelper
{
public ClientSecrets GetClientSecrets()
{
string clientId = googleSettings.ClientId ?? string.Empty;
string clientSecret = googleSettings.ClientSecret ?? string.Empty;
return new() { ClientId = clientId, ClientSecret = clientSecret };
}
public string[] GetScopes()
{
var scopes = new[]
{
Oauth2Service.Scope.Openid,
Oauth2Service.Scope.UserinfoEmail,
Oauth2Service.Scope.UserinfoProfile
};
return scopes;
}
public string ScopeToString() => string.Join(", ", GetScopes());
}
}