This repository was archived by the owner on Apr 26, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
This repository was archived by the owner on Apr 26, 2024. It is now read-only.
jwt token is not registering but, does login only #7604
Copy link
Copy link
Closed
Labels
Description
Description
jwt token is not registering new user. but, can login with jwt for m.login.jwt
Bug is here. As, user_id being overwritten with None and calling UserID.from_string(None).localpart
synapse/synapse/rest/client/v1/login.py
Line 335 in b2b8699
| user_id = await self.auth_handler.check_user_exists(user_id) |
synapse/synapse/rest/client/v1/login.py
Line 338 in b2b8699
| localpart=UserID.from_string(user_id).localpart |
Steps to reproduce
- Enable jwt token
jwt_config:
enabled: true
secret: "a secret"
algorithm: "HS256"- Generate a jwt token at HTTP://jwt.io
let cheeky_monkey_jwt = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJjaGVla3lfbW9ua2V5IiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.qDmRJP1eZSKJsrq9fGI1qiOXT-ZDqTdgD4E8TN6oJ-A"
- Call using matrix-js-sdk
import Matrix from "matrix-js-sdk";
const tempClient = Matrix.createClient({ baseUrl: hsUrl });
let callback = (data) => console.log('login callback: ', data);
const data = await tempClient.login(
'm.login.jwt',
{
token: cheeky_monkey_jwt,
},
callback
).catch(console.log);
const matrixClient = Matrix.createClient({
baseUrl: hsUrl,
accessToken: data.access_token,
userId: data.user_id,
});
await matrixClient.startClient();Version information
- Homeserver:
If not matrix.org:
- Version:
1.14.0, Commit:91a7c5ff6d3a4bc30d61da96e4923d391c6d2ed9 - Install method:
git clone - Platform:
ubuntu 16
Fix is simple gotcha
if create_non_existant_users:
user_exists = await self.auth_handler.check_user_exists(user_id)
if not user_exists :
user_id = await self.registration_handler.register_user(
localpart=UserID.from_string(user_id).localpart
)Reactions are currently unavailable