Skip to content
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

Use a newly generated access_token while joining Jitsi #24646

Merged
merged 4 commits into from
Mar 22, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 6 additions & 9 deletions src/vector/jitsi/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -212,13 +212,6 @@ const setupCompleted = (async (): Promise<string | void> => {

if (widgetApi) {
await widgetApiReady;

// See https://github.com/matrix-org/prosody-mod-auth-matrix-user-verification
richvdh marked this conversation as resolved.
Show resolved Hide resolved
if (jitsiAuth === JITSI_OPENIDTOKEN_JWT_AUTH) {
// Request credentials, give callback to continue when received
openIdToken = await widgetApi.requestOpenIDConnectToken();
logger.log("Got OpenID Connect token");
}
}

// Now that everything should be set up, skip to the Jitsi splash screen if needed
Expand All @@ -234,7 +227,7 @@ const setupCompleted = (async (): Promise<string | void> => {
})();

function enableJoinButton(): void {
document.getElementById("joinButton").onclick = (): void => joinConference();
document.getElementById("joinButton").onclick = (): Promise<void> => joinConference();
}

function switchVisibleContainers(): void {
Expand Down Expand Up @@ -345,9 +338,13 @@ function mapLanguage(language: string): string {
// audio input it can find, while an input of null instructs it to start muted,
// and a non-nullish input specifies the label of a specific device to use.
// Same for video inputs.
function joinConference(audioInput?: string | null, videoInput?: string | null): void {
async function joinConference(audioInput?: string | null, videoInput?: string | null): Promise<void> {
let jwt;
if (jitsiAuth === JITSI_OPENIDTOKEN_JWT_AUTH) {
// Request credentials, give callback to continue when received
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand this comment. If it also makes no sense to you, I suggest we remove it rather than copying it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment is older than the code - it should be removed.

openIdToken = await widgetApi.requestOpenIDConnectToken();
emrahcom marked this conversation as resolved.
Show resolved Hide resolved
logger.log("Got OpenID Connect token");

if (!openIdToken?.access_token) {
richvdh marked this conversation as resolved.
Show resolved Hide resolved
// eslint-disable-line camelcase
// We've failing to get a token, don't try to init conference
Expand Down