How to configure login fail message in custom auth using Graphql request

Hello, I config the login auth using graphql. I found even thought my response is contain errors, the retool still show "Successfully authed!".

here is my graphql response

	"errors": [
			"message": "Non-nullable field 'username' (type String!) was not present in result from Dgraph.  GraphQL error propagation triggered.",
			"locations": [
					"line": 4,
					"column": 3
			"path": [
	"data": {
		"Authenticate": null
	"extensions": {
		"tracing": {
			"version": 1,
			"startTime": "2022-01-15T07:31:16.6561004Z",
			"endTime": "2022-01-15T07:31:16.7217542Z",
			"duration": 65653800

and I found there is no place in UI to config the errors in graphql resource UI.

I read the docs but found no instruction about this.

Custom API authentication

any help will be appreciated.

Hey @AnsonHwang,

you can create a new JS query and add it to the failure event handler of that query.

In your JS query you would do something like this:

  title: "GraphQL API Error",
  notificationType: "error",
  duration: 2,

Would that work for you?

Hello, thanks. It's a good idea. But there is not hook for failure event handler in Custom authentication.

Hey @AnsonHwang!

Happy to help here! How is this endpoint expecting your users username/password to be passed? If in a header or URL param you can reference these values input by your user using {{form1.username}} or {{form1.pwd}}. Do you think this could work for your use case here?

Hey @Chris-Thompson , thanks for your reply. I did get pass username and password via Graphql's variable(using {{form1.username}} or {{form1.pwd}} ).
but my question is if the user pass the wrong password, the graphql's response will contain errors key-value in response body(the response status code of graphql is alway 200). Retool should show a error messega here instead of successful.
Retool don't handle the graphql response well here. It should resolve the graphql response by inspect its response body not by status code of response body.

As metioned in doc

Custom API authentication
All API Resource authentication methods apply to both REST and GraphQL resources!

I think it is still not complete apply to GraphQL resources.

Hey @AnsonHwang — I see what you mean. Custom Auth in Retool is specifically looking for a failure error code and GraphQL always returns a 200 (also in a token refresh flow). I've added this thread to an internal feature request for error handling similar to that found in the query builders "Response" tab so you would be able to handle responses more dynamically and will keep you updated as I hear back from our engineering team.