User Tools

Site Tools


sysadminery:matrix

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
sysadminery:matrix [2024/04/02 14:57] – [curl as client] adamsysadminery:matrix [2024/10/31 03:17] (current) adam
Line 16: Line 16:
 pw='asdf'"'"'fdsa' pw='asdf'"'"'fdsa'
 </code> </code>
 +we're going to do the same to glue the password in.
 +
 +username doesn't have to be your //full// username. (less-past adam here: idk wtf he means. just do full. @user:greyn.club.)
  
 <code> <code>
 pw='PASSWORD' pw='PASSWORD'
 echo $pw echo $pw
-curl -XPOST -d '{"type":"m.login.password", "user":"USERNAME", "password":"$pw"}' "https://greyn.club:8448/_matrix/client/r0/login"+curl -XPOST -d '{"type":"m.login.password", "user":"USERNAME", "password":"'"$pw"'"}' "https://greyn.club:8448/_matrix/client/r0/login"
 </code> </code>
 that'll give you back a json object, including an access token that'll give you back a json object, including an access token
 +
 +now for extra fun: get yourself ''jq''. take the json you get back, pipe it to jq, tell jq you just want the access_token.
 +
 +<code>
 +pw='PASSWORD'
 +username='@USERNAME:greyn.club'
 +echo $pw
 +token=$(curl -XPOST -d '{"type":"m.login.password", "user":"'"$username"'", "password":"'"$pw"'"}' "https://greyn.club:8448/_matrix/client/r0/login" | jq .access_token --raw-output)
 +echo $token
 +</code>
 +
 <code> <code>
 curl -XPOST \ curl -XPOST \
Line 28: Line 42:
     "https://greyn.club:8448/_matrix/client/r0/rooms/"'!'"pPZWsacCoTafJoyJXu:greyn.club/send/m.room.message?access_token=ACCESSTOKEN"     "https://greyn.club:8448/_matrix/client/r0/rooms/"'!'"pPZWsacCoTafJoyJXu:greyn.club/send/m.room.message?access_token=ACCESSTOKEN"
 </code> </code>
 +
sysadminery/matrix.1712069842.txt.gz · Last modified: 2024/04/02 14:57 by adam