add loginMethod along with oidc in queryLogin

This commit is contained in:
Ajay Bura 2022-08-16 15:45:00 +05:30
parent 7ba2f26624
commit 59853ebf11

View File

@ -130,6 +130,7 @@ export class Client {
const { homeserver, issuer, account } = await lookupHomeserver(initialHomeserver, (url, options) => { const { homeserver, issuer, account } = await lookupHomeserver(initialHomeserver, (url, options) => {
return setAbortable(this._platform.request(url, options)); return setAbortable(this._platform.request(url, options));
}); });
let oidc = undefined;
if (issuer) { if (issuer) {
try { try {
const oidcApi = new OidcApi({ const oidcApi = new OidcApi({
@ -139,18 +140,16 @@ export class Client {
crypto: this._platform.crypto, crypto: this._platform.crypto,
}); });
await oidcApi.validate(); await oidcApi.validate();
oidc = { issuer, account }
return {
homeserver,
oidc: { issuer, account },
};
} catch (e) { } catch (e) {
console.log(e); console.log(e);
} }
} }
const hsApi = new HomeServerApi({homeserver, request: this._platform.request}); const hsApi = new HomeServerApi({homeserver, request: this._platform.request});
const response = await setAbortable(hsApi.getLoginFlows()).response(); const response = await setAbortable(hsApi.getLoginFlows()).response();
return this._parseLoginOptions(response, homeserver); const result = this._parseLoginOptions(response, homeserver);
result.oidc = oidc;
return result;
}); });
} }