diff --git a/GraphRunner.ps1 b/GraphRunner.ps1 index df46f38..c62f13f 100644 --- a/GraphRunner.ps1 +++ b/GraphRunner.ps1 @@ -1475,25 +1475,29 @@ function Get-TeamsApps{ $Tokens ) if(!$Tokens){ - # Login - Write-Host -ForegroundColor yellow "[*] First, you need to login." - Write-Host -ForegroundColor yellow "[*] If you already have tokens you can use the -Tokens parameter to pass them to this function." - while($auth -notlike "Yes"){ - Write-Host -ForegroundColor cyan "[*] Do you want to authenticate now (yes/no)?" - $answer = Read-Host - $answer = $answer.ToLower() - if ($answer -eq "yes" -or $answer -eq "y") { - Write-Host -ForegroundColor yellow "[*] Running Get-GraphTokens now..." - $tokens = Get-GraphTokens -ExternalCall - $auth = "Yes" - } elseif ($answer -eq "no" -or $answer -eq "n") { - Write-Host -ForegroundColor Yellow "[*] Quitting..." - return - } else { - Write-Host -ForegroundColor red "Invalid input. Please enter Yes or No." + if ($global:tokens){ + $tokens = $global:tokens + } else { + # Login + Write-Host -ForegroundColor yellow "[*] First, you need to login." + Write-Host -ForegroundColor yellow "[*] If you already have tokens you can use the -Tokens parameter to pass them to this function." + while($auth -notlike "Yes"){ + Write-Host -ForegroundColor cyan "[*] Do you want to authenticate now (yes/no)?" + $answer = Read-Host + $answer = $answer.ToLower() + if ($answer -eq "yes" -or $answer -eq "y") { + Write-Host -ForegroundColor yellow "[*] Running Get-GraphTokens now..." + $tokens = Get-GraphTokens -ExternalCall + $auth = "Yes" + } elseif ($answer -eq "no" -or $answer -eq "n") { + Write-Host -ForegroundColor Yellow "[*] Quitting..." + return + } else { + Write-Host -ForegroundColor red "Invalid input. Please enter Yes or No." + } } } - } + } $access_token = $tokens.access_token $headers = @{ Authorization = "Bearer $access_token" @@ -1526,6 +1530,7 @@ function Get-TeamsApps{ } } + function Get-TeamsChat{ <# .SYNOPSIS