Public/Set-O365Jwt.ps1

Function Set-O365Jwt {
    Param (
        #
        [Parameter(Mandatory)]
        [String]
        $JwtToken,
    
        #
        [Parameter()]
        [String]
        $Location = (Join-Path $HOME ".psdtx")
    )
    if(Test-O365Jwt -JwtToken $JwtToken -Verbose){
        [System.IO.File]::WriteAllText($Location,$JwtToken,[System.Text.Encoding]::UTF8)
        $script:O365Jwt = $JwtToken
    }else{
        throw "Token not valid!"
    }
  }