I am implementing an Oauth2 server on my side with PHP using OAuth2 - PHPLeague
I have configured email and password as Authentication Fields
Then I add them to the Authorization url so I can do validation and authentication on my oauth2 server.
This part is working, but I am wondering if I can send it through the header to avoid having to encode it in the url?, I have tried adding these parameters to the headers form, but after I save the header is removed. Not sure if I am missing a naming convention on headers params,
I am not able to show an error in zapier when calling authorization endpoint. I have tried returning a PSR7 response and simple json response.
But I only see a white screen, what is the correct error response format?
On the Authorization request I return the user id, but I also need to return other user info to use on the Connection Label. On the test endpoint I had no problems since I found an example where I needed to return a json with: id, name and email fields, but not sure how to do it when doing the full process: Authorization Url + Access Token Request, not sure in what point you read that info.
Question 1, sending messages in the body vs. url params:
For this OAuth 2 flow this is an HTTP GET in most implementations, and so there is no body sent.
Question 2, showing an error:
So this is a request handler on your server once we’ve redirected to you, yeah? I think you just want to return an HTML page with the error info for the user on it, rather than trying to redirect back to us for us to render that message at that point in the flow. Perhaps someone else can provide some guidance here…
Question 3, connected account label:
If that data is returned by your auth test request, you can reference it in bundle.inputData.yourfieldname if it’s extra information returned with your token request, you might look at computed fields to add that data to bundle.authData.***
@Zane, thanks for the reply, about question 1, I found that we can enable sending body in get requests in zapier, there is a parameter: allowGetBody
But not sure how to use it on Authorization Url, since I need to return a url, maybe this is useful in other GET requests.
Any thoughts on this?
Digging in, remembering that that request is handled differently than other requests throughout the schema.
Check out the authorizeUrl at https://zapier.github.io/zapier-platform-schema/build/schema.html#authenticationoauth2configschema - it expects a RedirectRequest object, rather than a standard request configuration.
If I’m thinking about this correctly, this makes sense - this request is being made from the user’s browser, not going through the platform like everything else.
In short, I think the way you were configuring that request it is the way to do it.