Public/Get-SfHeaders.ps1

<#
    .SYNOPSIS
    Authenticates with Salesforce and returns bearer token header for future calls

    .DESCRIPTION
    Authenticates with Salesforce and returns bearer token header for future calls

    .INPUTS
    None. You cannot pipe objects to Get-SfDevices.

    .OUTPUTS
    A PSCustomObject with the "Authorization" key and the bearer token.

    .EXAMPLE
    PS> Set-FileConfig; (Get-SfHeaders)['Authorization']
    Bearer 00D4J0000001pvr!ARkAQLxHMmfUHYvbKYmRveGi.SayYuxZ4vL18Ra9Sk0eBh1hciD3yuItxmdLoNgB0R1v8xQE5cl.FnnjUxL1L_afg7FgmLnN

    .LINK
    Set-Config

    .NOTES
    Assumes config is initialized for org access.
#>

function Get-SfHeaders {

    [CmdletBinding()]
    [OutputType([PSCustomObject])]
    param()

    begin {
        Write-Verbose "[$($MyInvocation.MyCommand.Name)] Function started"
    }

    end {
        Write-Verbose "[$($MyInvocation.MyCommand.Name)] Complete"
    }

    process {
        Write-Debug "[$($MyInvocation.MyCommand.Name)] PSBoundParameters: $($PSBoundParameters | Out-String)"

        $access_token = $script:__sfAuth.access_token
        @{ "Authorization" = "Bearer $($access_token)" }
    }
}