From c93a9f614cbda1b593dc59be7edb94b39f293cc5 Mon Sep 17 00:00:00 2001 From: Thumbscrew Date: Sat, 12 Mar 2022 22:15:09 +0000 Subject: [PATCH] fix token as SecureString --- public/Get-MatrixLoginToken.ps1 | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/public/Get-MatrixLoginToken.ps1 b/public/Get-MatrixLoginToken.ps1 index 66f0ed2..e7ebc95 100644 --- a/public/Get-MatrixLoginToken.ps1 +++ b/public/Get-MatrixLoginToken.ps1 @@ -1,9 +1,9 @@ <# .Synopsis - Login and retrieve an Access token. + Login and retrieve an Access token (returned as a SecureString). .Description - Login and retrieve an Access token from _matrix/client/v3/login. See https://spec.matrix.org/v1.2/client-server-api/#post_matrixclientv3login. + Login and retrieve an Access token from _matrix/client/v3/login (returned as a SecureString). See https://spec.matrix.org/v1.2/client-server-api/#post_matrixclientv3login. .Parameter ServerUrl URL for the Matrix server to log into, for example "https://matrix.example.com". @@ -35,11 +35,12 @@ function Get-MatrixLoginToken { } type = "m.login.password" password = $Credentials.Password | ConvertFrom-SecureString -AsPlainText + initial_device_display_name = "PSMatrix" } | ConvertTo-Json $res = Invoke-RestMethod -Uri "$ServerUrl/$apiPath" -Method $apiMethod -Body $reqBody - $token = $res.access_token | ConvertTo-SecureString + $token = $res.access_token | ConvertTo-SecureString -AsPlainText return $res.access_token } \ No newline at end of file