Public/Get-ConnectorAuthSettings.ps1

<#
.SYNOPSIS
    Returns the authentication settings (FQDN and OAuth scope) for the target API environment.

.DESCRIPTION
    Returns a hashtable containing the FQDN and OAuth scope for the Fortytwo IAM API
    based on whether the Internal and/or Development switches are set. Used internally
    by Connect-Connector to build the API root URL.

.PARAMETER Development
    If set, returns settings for the development environment.

.PARAMETER Internal
    If set, returns settings for the internal (first-party) API endpoint.

.OUTPUTS
    System.Collections.Hashtable

.EXAMPLE
    Get-ConnectorAuthSettings

.EXAMPLE
    Get-ConnectorAuthSettings -Development

.EXAMPLE
    Get-ConnectorAuthSettings -Internal -Development
#>

function Get-ConnectorAuthSettings {
    [CmdletBinding()]
    [OutputType([System.Collections.Hashtable])]
    param (
        [Switch] $Development,
        
        [Switch] $Internal
    )

    if ($Internal.IsPresent) {
        if ($Development.IsPresent) {
            @{
                fqdn  = "dev-api.internal.byfortytwo.com"
                scope = "api://18c51ab6-2a8e-45c8-bd52-5511b04fe396/.default"
            }
        }
        else {
            @{
                fqdn  = "internal-api.fortytwo.io"
                scope = "https://internal-api.fortytwo.io/.default"
            }
        }
    }
    else {
        if ($Development.IsPresent) {
            @{
                fqdn  = "dev-api.byfortytwo.com"
                scope = "https://dev-api.byfortytwo.com/.default"
            }
        }
        else {
            @{
                fqdn  = "api.internal.fortytwo.io"
                scope = "https://api.internal.fortytwo.io/.default"
            }
        }
    }
}