mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-12-24 12:04:57 +01:00
Make hydrogen generate the device scope
This commit is contained in:
parent
897fc54103
commit
12d1760582
@ -42,12 +42,13 @@ export class StartOIDCLoginViewModel extends ViewModel {
|
|||||||
async discover() {
|
async discover() {
|
||||||
// Ask for the metadata once so it gets discovered and cached
|
// Ask for the metadata once so it gets discovered and cached
|
||||||
await this._api.metadata()
|
await this._api.metadata()
|
||||||
await this._api.ensureRegistered();
|
await this._api.registration();
|
||||||
}
|
}
|
||||||
|
|
||||||
async startOIDCLogin() {
|
async startOIDCLogin() {
|
||||||
|
const deviceScope = this._api.generateDeviceScope();
|
||||||
const p = this._api.generateParams({
|
const p = this._api.generateParams({
|
||||||
scope: "openid",
|
scope: `openid ${deviceScope}`,
|
||||||
redirectUri: this.urlCreator.createOIDCRedirectURL(),
|
redirectUri: this.urlCreator.createOIDCRedirectURL(),
|
||||||
});
|
});
|
||||||
const clientId = await this._api.clientId();
|
const clientId = await this._api.clientId();
|
||||||
|
@ -203,6 +203,11 @@ export class OidcApi {
|
|||||||
return metadata["registration_endpoint"];
|
return metadata["registration_endpoint"];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
generateDeviceScope(): String {
|
||||||
|
const deviceId = randomString(10);
|
||||||
|
return `urn:matrix:device:${deviceId}`;
|
||||||
|
}
|
||||||
|
|
||||||
generateParams({ scope, redirectUri }: { scope: string, redirectUri: string }): AuthorizationParams {
|
generateParams({ scope, redirectUri }: { scope: string, redirectUri: string }): AuthorizationParams {
|
||||||
return {
|
return {
|
||||||
scope,
|
scope,
|
||||||
|
Loading…
Reference in New Issue
Block a user