Public/Get-O365JwtPayload.ps1

Function Get-O365JwtPayload {
    Param (#
        [Parameter(Mandatory)]
        [String]
        $JwtToken
    )
    $SplitToken = $JwtToken.Replace('-', '+').Replace('_', '/').Split(".")
    $SplitToken[1] | ForEach-Object {
        # Write-Host "'$PSItem'"
        $t = $PSItem
        while(($t.length % 4) -ne 0){
            $t += "="
        }
        # Write-Verbose "Payload Bas64: $($t)"
        [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($t)) | ConvertFrom-Json
    }
}