-
Notifications
You must be signed in to change notification settings - Fork 399
MSC3882: Allow an existing session to sign in a new session #3882
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
Merged
Merged
Changes from 8 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
6532fed
Allow an existing session to sign in a new session
hughns 3848ff6
MSC3882
hughns f5bc790
Line length
hughns a081662
Resolve TODOs
hughns 3682aa1
Document unstable prefixes
hughns 71294a3
Add docs on data returned by request
hughns cafe8f6
Reference to MSC3906
hughns f6a0054
Incorporate review feedback
hughns 02df2bc
Apply suggestions from code review
hughns 3c47a8f
Add note on rate limiting
hughns d4aea45
Revision 1 of proposal
hughns 3a44d29
Update proposals/3882-login-token-request.md
hughns 07ca770
Refer to spec about not requiring auth
hughns 9d9206a
Merge branch 'hughns/login-token-requests' of https://github.com/matr…
hughns 090efd8
Expose availability via capabilities
hughns 1c8db5b
Update proposals/3882-login-token-request.md
hughns b75b14f
Use GET /login when unauthenticated
hughns b9baebf
Apply suggestions from code review
hughns File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
# MSC3882: Allow an existing session to sign in a new session | ||
|
||
In [MSC3906](https://github.com/matrix-org/matrix-spec-proposals/pull/3906) a proposal is made to allow a user to login | ||
on a new device using an existing device by means of scanning a QR code. | ||
|
||
In order to support the above proposal a mechanism is needed where by the new device can obtain a new access token that | ||
it can use with the Client-Server API. | ||
|
||
It is proposed that the current `m.login.token` mechanism is extended to allow the issuance of a login token by an | ||
existing client session. | ||
|
||
## Proposal | ||
|
||
Add a new POST endpoint to the Client-Server API that issues a time limited `m.login.token` token: | ||
|
||
`POST /login/token` | ||
|
||
```json | ||
{ | ||
"login_token": "<login token>", | ||
"expires_in": 120 | ||
hughns marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
``` | ||
hughns marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
This new endpoint should be protected by user interactive authentication (UIA). However the the homeserver admin may | ||
choose to disable UIA if they deem suitable alternative protections are in place. | ||
richvdh marked this conversation as resolved.
Show resolved
Hide resolved
hughns marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
The values returned are: | ||
|
||
- `login_token` - required, the token to use with `m.login.token` | ||
- `expires_in` - required, the expiry time for the token in seconds | ||
hughns marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
This token can then be used as per the existing Login spec of the Client-Server API as follows: | ||
hughns marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
`POST /login` | ||
|
||
```json | ||
{ | ||
"type": "m.login.token", | ||
"token": "<login token>" | ||
} | ||
``` | ||
|
||
## Potential issues | ||
|
||
None identified. | ||
|
||
## Alternatives | ||
|
||
If Matrix was already using OIDC as per [MSC3861](https://github.com/matrix-org/matrix-spec-proposals/pull/3861) then we | ||
could use the device authorization grant flow which allows for a new device to be signed in using an existing device. | ||
|
||
## Security considerations | ||
|
||
A malicious client could use the mechanism to spawn more than one session. For this reason the endpoint should by default | ||
be placed behind user interactive authentication. | ||
|
||
## Unstable prefix | ||
|
||
While this feature is in development the new endpoint should be exposed using the following unstable prefix: | ||
|
||
- `/_matrix/client/unstable/org.matrix.msc3882/login/token` | ||
|
||
Additionally, the feature is to be advertised as unstable feature in the `GET /_matrix/client/versions` | ||
response, with the key `org.matrix.msc3882` set to `true`. So, the response could look then as | ||
following: | ||
richvdh marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
```json | ||
{ | ||
"versions": ["r0.6.0"], | ||
"unstable_features": { | ||
"org.matrix.msc3882": true | ||
} | ||
} | ||
``` | ||
|
||
## Dependencies | ||
|
||
None. |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.