mirror of
https://github.com/Thumbscrew/PSMatrix.git
synced 2024-11-09 23:53:51 +00:00
add optional DeviceDisplayName parameter
This commit is contained in:
parent
e648d011f5
commit
605a50b713
@ -11,6 +11,9 @@
|
|||||||
.Parameter Credentials
|
.Parameter Credentials
|
||||||
PSCredentials Object that contains the Matrix Username and Password for the user you wish to log in with.
|
PSCredentials Object that contains the Matrix Username and Password for the user you wish to log in with.
|
||||||
|
|
||||||
|
.Parameter DeviceDisplayName
|
||||||
|
Display name to assign to this Access token.
|
||||||
|
|
||||||
.Example
|
.Example
|
||||||
# Create a PSCredentials Object
|
# Create a PSCredentials Object
|
||||||
$creds = Get-Credential
|
$creds = Get-Credential
|
||||||
@ -22,7 +25,10 @@ function New-MatrixAccessToken {
|
|||||||
[string]$ServerUrl,
|
[string]$ServerUrl,
|
||||||
|
|
||||||
[Parameter(Mandatory)]
|
[Parameter(Mandatory)]
|
||||||
[PSCredential]$Credentials
|
[PSCredential]$Credentials,
|
||||||
|
|
||||||
|
[Parameter(Mandatory=$false)]
|
||||||
|
[string]$DeviceDisplayName="PSMatrix"
|
||||||
)
|
)
|
||||||
|
|
||||||
$apiPath = "_matrix/client/v3/login"
|
$apiPath = "_matrix/client/v3/login"
|
||||||
@ -35,7 +41,7 @@ function New-MatrixAccessToken {
|
|||||||
}
|
}
|
||||||
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"
|
initial_device_display_name = $DeviceDisplayName
|
||||||
} | ConvertTo-Json
|
} | ConvertTo-Json
|
||||||
|
|
||||||
$res = Invoke-RestMethod -Uri "$ServerUrl/$apiPath" -Method $apiMethod -Body $reqBody
|
$res = Invoke-RestMethod -Uri "$ServerUrl/$apiPath" -Method $apiMethod -Body $reqBody
|
||||||
|
Loading…
Reference in New Issue
Block a user