-
Notifications
You must be signed in to change notification settings - Fork 155
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add user registration and deactivation #112
Comments
Since you've marked as a good first issue, I'd like to volunteer to tackle it myself. |
The way you start adding this is to add a definition here. After that you'll need to write a json schema for the response here. A response type will be needed here. After that you hook up the I think registering gives you an access token so you'll probably need to handle the response like a login. |
Before working on the deactivation, I wanted to be sure I fully understood the code I'd worked on and the examples I had based it on in your code. Based on your documentation I put in the following code: import asyncio
from nio import AsyncClient
async def main():
client = AsyncClient("https://matrix.ericmesa.com", "@username:matrix.ericmesa.com")
await client.login(password="password")
await client.close()
asyncio.get_event_loop().run_until_complete(main()) And no matter whether I put in registered names or made-up names, I would not get any output to the terminal or the Pycharm runner. But if I understood responses.py, I should have had an output like: "Logged in as username, device id: something. Right? What am I doing wrong? This is with Python 3.7. |
The lib has a lobgook based logging setup, but it won't print out anything by default. |
Question for the deactivation. I did a bunch of tests and basically what I need to provide to the server is: curl --insecure -XPOST -H "Authorization: Bearer An_Admin_User_Token" -H "Content-Type: application/json" -d '{}' "https://server/_matrix/client/r0/admin/deactivate/%40UserName%3Aserver" So:
|
There is no support to use the Yes, all URLs should already be escaped. |
By query string do you mean the part in the the JSON? |
No, the part that gets into the URL after the question mark separator. |
ah, OK. Will give this a shot over the next couple days. |
when I try to register a new user I get RegisterErrorResponse: unknown error
|
I think its because of the auth issue. It does not ask me for my email or ask if I am a robot? which it does if I try to signup manually through element |
Hmm, I wonder if I'm running into this too. I tried to find out what was going on with the I also tried it with matrix.org as the server, and saw:
But even then I was greeted with I kept trying, until I managed to find a server what worked! So it does work, it's just that most servers give a 401 response.
Yes, it probably all depends on the server. Checking what type of manual acount creation is available is probably a good suggestion to people struggling with this issue, but I also found servers that allowed the creation of these basic accounts in the UI, just not via the API. My thoughts:
// I kept trying public servers. I also spotted a 502 Bad Gateway. And I even saw actual useful error messages too, such as M_UNRECOGNIZED and M_FORBIDDEN :-) |
The correct $ curl --insecure -XPOST -H "Content-Type: application/json" -d '{}' "https://DOMAIN/_synapse/admin/v1/deactivate/%40USER%3ADOMAIN?access_token=s....C"
{"errcode":"M_UNKNOWN","error":"Can only deactivate local users"} I still have an error but it's better than the $ curl --insecure -XPOST -H "Content-Type: application/json" -d '{}' "https://DOMAIN/_matrix/client/r0/deactivate/%40USER%3ADOMAIN?access_token=s...C"
{"errcode":"M_UNRECOGNIZED","error":"Unrecognized request"} The first command fits the deactivation request implementation in synapse-admin. |
I don't see any functions for either in the documentation.
The text was updated successfully, but these errors were encountered: