Hey everyone, I’m stuck with a Zapier OAuth2 problem. I’ve got this test Node.js app set up to handle login requests from Zapier. But when I try to send the access_token, Zapier keeps throwing an error.
Here’s a simplified version of what I’m working with:
But Zapier keeps saying it can’t find the access_token field in the OAuth2 results. Am I missing something obvious here? Any ideas on how to fix this? Thanks in advance for any help!
hey there swimminshark! i ran into a similar issue. zapier expects the access_token in the response body, not as a query param. try sending a JSON response instead:
I’ve dealt with OAuth2 in Zapier before, and there’s a crucial detail you’re overlooking. Zapier doesn’t support the implicit flow you’re trying to use. Instead, you need to implement the authorization code flow.
Here’s what you should do:
In your /auth endpoint, generate an authorization code instead of an access token.
Redirect the user back to Zapier with this code.
Zapier will then make a server-to-server request to exchange this code for an access token.
You’ll need to set up another endpoint (like /token) to handle this exchange. This approach is more secure and aligns with Zapier’s expectations.
Remember to store the authorization code temporarily and associate it with the user. When Zapier hits your /token endpoint, verify the code and then return the access token in the response body as JSON.
This should solve your issue and get your Zapier integration working smoothly.
I’ve encountered this issue before. The problem lies in how you’re sending the access_token. Zapier expects it in the response body, not as a URL parameter. Here’s what you should do:
Instead of redirecting, send a JSON response with the access_token:
This should resolve the error you’re seeing. Make sure your Zapier OAuth settings are configured to expect the token from your server’s response. Let me know if you need any clarification on implementing this change.