mirror of
https://github.com/Thumbscrew/PSMatrix.git
synced 2025-01-18 17:45:44 +00:00
fix token as SecureString
This commit is contained in:
parent
d6ce1b196e
commit
c93a9f614c
@ -1,9 +1,9 @@
|
|||||||
<#
|
<#
|
||||||
.Synopsis
|
.Synopsis
|
||||||
Login and retrieve an Access token.
|
Login and retrieve an Access token (returned as a SecureString).
|
||||||
|
|
||||||
.Description
|
.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
|
.Parameter ServerUrl
|
||||||
URL for the Matrix server to log into, for example "https://matrix.example.com".
|
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"
|
type = "m.login.password"
|
||||||
password = $Credentials.Password | ConvertFrom-SecureString -AsPlainText
|
password = $Credentials.Password | ConvertFrom-SecureString -AsPlainText
|
||||||
|
initial_device_display_name = "PSMatrix"
|
||||||
} | ConvertTo-Json
|
} | ConvertTo-Json
|
||||||
|
|
||||||
$res = Invoke-RestMethod -Uri "$ServerUrl/$apiPath" -Method $apiMethod -Body $reqBody
|
$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
|
return $res.access_token
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user