I just went through the tutorial video on YouTube: tutorial, sample app, and done everything in the video. In the last step, when i launched the zoom app, the app was launched, but it pops out an error “An unknown error occurred, Error code: 122”. I cannot resolve it, and I didn’t find information about this error.
Thank you for posting in the Zoom Developer Forum and I am happy to help! As a start, can you share the error message you are seeing and the steps to reproduce if possible?
if i click https://…ngrok.io/auth
then i receive this
Error 400
invalid state parameter
BadRequestError: invalid state parameter
at handleError (file:///home/user/Documents/zoomapps_sample/server/helpers/routing.js:35:12)
at file:///home/user/Documents/zoomapps_sample/server/routes/auth.js:55:14
at Layer.handle [as handle_request] (/home/user/Documents/zoomapps_sample/node_modules/express/lib/router/layer.js:95:5)
at next (/home/user/Documents/SURE/zoomapps_sample/node_modules/express/lib/router/route.js:137:13)
at middleware (/home/user/Documents/zoomapps_sample/node_modules/express-validator/src/middlewares/check.js:16:13)
Instead of navigating to the auth route to install the app, try opening the home page in a browser. You should see a link to install the app which will generate a state and start the authorization flow.
Are you navigating directly to the /auth page or are you clicking the install link from the home page? Using the install link from the home page is what you’ll want to do with this app as it will generate the state parameter that needs to be verified.
It seems like the session is being cleared when redirecting to the /auth handler, hence the validation (checking if the query parameters matches the session parameters) fails, not sure if this is the intended behavior
I recloned the repo and still face the same error:
Error 400
invalid state parameter
BadRequestError: invalid state parameter
at handleError (file:///home/shunji/zoomapps-sample-js/server/helpers/routing.js:35:12)
at file:///home/shunji/zoomapps-sample-js/server/routes/auth.js:55:14
at Layer.handle [as handle_request] (/home/shunji/zoomapps-sample-js/node_modules/express/lib/router/layer.js:95:5)
at next (/home/shunji/zoomapps-sample-js/node_modules/express/lib/router/route.js:137:13)
at middleware (/home/shunji/zoomapps-sample-js/node_modules/express-validator/src/middlewares/check.js:16:13)
as mentioned in the previous reply, it seems the session does not persist between the redirect from the /install to the /auth handler, this does not seem to be a problem with repo.
It seems like the documentation recommends to store the code_verifier and state_noonce in the db and not in the session, so maybe this is the issue?
I am also getting a similar error from the advanced app example, it is also retrieving the state from the session
Error: Invalid state parameter
at auth (/home/node/app/api/zoomapp/controller.js:173:21)
at Layer.handle [as handle_request] (/home/node/app/node_modules/express/lib/router/layer.js:95:5)
at next (/home/node/app/node_modules/express/lib/router/route.js:144:13)
at Route.dispatch (/home/node/app/node_modules/express/lib/router/route.js:114:3)
at Layer.handle [as handle_request] (/home/node/app/node_modules/express/lib/router/layer.js:95:5)
at /home/node/app/node_modules/express/lib/router/index.js:284:15
at Function.process_params (/home/node/app/node_modules/express/lib/router/index.js:346:12)
at next (/home/node/app/node_modules/express/lib/router/index.js:280:10)
at Function.handle (/home/node/app/node_modules/express/lib/router/index.js:175:3)
at router (/home/node/app/node_modules/express/lib/router/index.js:47:12)
Navigating to localhost:3000, then clicking the install link, then going through Zoom OAuth, then redirected back and getting:
“Error 400
invalid state parameter”
I had this issue. I wasn’t using ngrok but a cloud provider. By enabling debug logging I was eventually able to see that cookie-session wasn’t able to save the cookies because it didn’t believe it was a secure connection - the cloud server was terminating TLS.
I turned on trusting the proxy headers (app.set('trust proxy', true)) and now all is good.