nimblehq / nimble-survey-web

Nimble Survey API for Mobile Challenge and Certification
0 stars 3 forks source link

When an access token is expired, requesting resource to a graphql endpoint, users receive a jsonapi error format #51

Closed sleepylee closed 3 years ago

sleepylee commented 3 years ago

What happened

this is an example of our error response right now when we submit a request for profile with an invalid token.

 {
   "errors": [
     {
       "source": "unauthorized",
       "detail": "The access token expired",
       "code": "invalid_token"
     }
   ]
 }

which is incorrect from a standard error message format.

The GraphQL standard expectation is:

 {
   "errors": [
     {
       "message": "Name for character with ID 1002 could not be fetched.",
       "locations": [{ "line": 6, "column": 7 }],
       "path": ["hero", "heroFriends", 1, "name"],
       "code": "CAN_NOT_FETCH_BY_ID",
       "timestamp": "Fri Feb 9 14:33:09 UTC 2018"
     }
   ]
 }