more scripts
This commit is contained in:
14
get_matrix_access_token.sh
Executable file
14
get_matrix_access_token.sh
Executable file
@@ -0,0 +1,14 @@
|
||||
#!/bin/bash
|
||||
if [ $# -ne 3 ]; then
|
||||
echo "Usage: $0 <username> <password> <matrix server domain>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
access_token=$(curl -s -XPOST -d '{"type":"m.login.password", "user":"'"$1"'", "password":"'"$2"'"}' "https://$3/_matrix/client/r0/login" | jq -r '.access_token')
|
||||
|
||||
if [ -z "$access_token" ]; then
|
||||
echo "Failed to retrieve access token. Please check your username and password."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "$access_token"
|
Reference in New Issue
Block a user