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 Hashtable with the "Authorization" key and the bearer token. .EXAMPLE PS> Set-FileConfig; (get-sfheaders)['Authorization'] Bearer 00D4J0000001pvr!ARkAQLxHMmfUHYvbKYmRveGi.SayYuxZ4vL18Ra9Sk0eBh1hciD3yuItxmdLoNgB0R1v8xQE5cl.FnnjUxL1L_afg7FgmLnN .LINK Set-FileConfig .NOTES Assumes config is initialized for org access. #> function Get-SfHeaders { param([String]$access_token) $response = Invoke-SfAuthenticate $access_token = $response.access_token @{ "Authorization" = "Bearer $($access_token)"} } |