TLDR
With the exact same code for in-client OAuth on Mac and Windows, our zoomSdk.addEventListener('onAuthorized', () => {})
event listener is working great on MacOS, but only triggers when in a Meeting on Windows, i.e. when runningContext == 'inMeeting'
- Mac:
-
runningContext === inMeeting
-onAuthorized
event listener called -
runningContext === inMainClient
-onAuthorized
event listener called
-
- Windows:
-
runningContext === inMeeting
-onAuthorized
event listener called -
runningContext === inMainClient
-onAuthorized
event listener NOT called
-
Zoom Apps Configuration
Here is our configuration function that we trigger on app initialization:
Both MacOS and Windows Zoom Clients are 5.12.8.
Zoom Apps SDK is version is 0.16.6
import zoomSdk from '@zoom/appssdk';
async function configureSdk() {
try {
const configResponse = await zoomSdk.config({
capabilities: [
'getSupportedJsApis',
'openUrl',
'getRunningContext',
'getMeetingContext',
'authorize',
'onAuthorized'
]
});
console.debug('Set up ZoomSDK: ', configResponse);
return Boolean(configResponse);
} catch (error) {
console.warn('There was an error configuring the JS SDK', error);
return false;
}
}
export default configureSdk;
In our React app we are using a custom hook for the in-client OAuth. I’ve omitted some pieces, but these are the steps up until we expect the onAuthorized
from the event listener. This is our setup, and I’ve compared it against the Advanced Sample App and as far as I can tell it’s the same config:
import { useEffect, useState } from 'react';
import zoomSdk from '@zoom/appssdk';
const useZoomInClientOauth = () => {
const [zoomApp, setZoomApp] = useState(null);
const [zoomPkceChallenge, setZoomPkceChallenge] = useState(null);
// kick off the in-client OAuth on first render
useEffect(() => {
createPkcePair();
}, []);
useEffect(() => {
console.log('zoomPkceChallenge useEffect: ', zoomPkceChallenge);
if (zoomPkceChallenge) {
console.log('We have saved zoomPkceChallenge, so setting the event listener');
zoomSdk.addEventListener('onAuthorized', (event) => {
console.log('onAuthorized event handler: ', event);
handleZoomOnAuthorized(zoomPkceChallenge, event);
});
}
}, [zoomPkceChallenge]);
const createPkcePair = () => {
// Makes a request to our server to generate the PKCE pair and state.
//
// When it resolves, we retrieve the pkceChallenge and state variables
// and call setZoomPkceChallenge() to set the zoomPkceChallenge variable.
// The presence of the new zoomPkceChallenge triggers the useEffect above.
startInClientOauth(pkceChallenge, state)
}
const = completeClientOauth= () => {
// This makes a request to our server to complete the OAuth.
//
// When complete, we call setZoomApp() to set that variable
// for the return of the hook.
}
const startInClientOauth = (pkceChallenge, state) => {
if (zoomSdk) {
zoomSdk
.authorize({
codeChallenge: pkceChallenge,
state,
codeChallengeMethod: 'S256'
})
.then((ret) => {
console.debug('Zoom Apps authorize return: ', ret);
})
.catch((e) => {
console.debug('Zoom Apps authorize error: ', e);
});
}
};
// This is called on MacOS, but is never called on Windows
const handleZoomOnAuthorized = (pkceChallenge, event) => {
console.debug('handleZoomOnAuthorized with event:', event);
completeClientOath({
variables: {
pkceChallenge,
code: event.code,
redirectUri: event.redirectUri
}
});
};
return { zoomApp };
};
export default useZoomInClientOauth;
Description
When this code runs on MacOS, and on Windows exclusively during a meeting, the onAuthorized
callback is triggered just fine, and produces the console messages in the correct order for the app:
However, when the exact same code, in the same Zoom account, with the same installed app, runs on a Windows on the main desktop client when runningContext === 'inMainClient'
, the code does trigger the zoomSdk.authorize({}), and we get the return promise from that function, but the onAuthorized
event listenter is never triggered. Only the first three lines from the screenshot above show up, and the onAuthorized
is never called.
Error?
There are no errors thrown.
Troubleshooting Routes
I’ve tried many different ways to trigger this event listenter, changed desktop version for both Mac and Windows, and tried following the example app code line-by-line, and I don’t see substantial differences.
How To Reproduce
I’m really just curious if you have heard of any differences for this event on Windows, and if so, how to get around them? If I’m the only one experiencing issues then that points to a code issue on our side, of course.