Custom Auth set-up using OAuth2 (Google) - URGENT HELP

Wait nvm, on the screenshot you sent later it does look like it was fixed.

Try changing query2 to GUI mode, use the following action type and filter by email = {{ startTrigger.data.EMAIL}}

I was replying the same. :sweat_smile:

There is a missing comma on the second screenshot as well:

Let's add it at the end of the value of ID_TOKEN

1 Like

Surprisingly, the email is the only value that is coming through, I was not expecting that to happen with the missing comma.

tried with fixing the missing comma: still the same error of test Oauthwork flow failed.

for query 2 which is failing the workflow - this is the error: Error evaluating query2: null value in column "access_token" of relation "Sucess_auth" violates not-null constraint

also, found something as well but can't pin point exactly where:
Screenshot 2024-11-14 at 3.50.09 AM

This last syntax error must have been from the missing comma. Did we deploy the WF after the updates?

yes, we did

Found it (potentially).

On the body params, we don't have access to oauth1. At this point, we should be referencing the variables defined on steps 2 and 3.

Change these body params to:

ACCESS_TOKEN ->  ACCESS_TOKEN
ID_TOKEN -> ID_TOKEN
REFRESH_TOKEN -> REFRESH_TOKEN
EMAIL -> {{ current_user.email }}

Note: Don't use double curly brackets for the variables.

the resource query doesn't allow any changes to be done once it's created. not sure if this is a bug

I'm creating another query and checking for this asap

1 Like

That may have been a UI bug, but we can definitely create a new resource. :slightly_smiling_face:

still the same error :confused:

this is what the API is requesting:

  1. request: Object

  2. url: "https://api.retool.com/v1/workflows/7e9f7a9b-a146-4bc7-b0a2-f11d30ab433f/startTrigger"

  3. method: "POST"

  4. body: "{"---sanitized---":"---sanitized---",""EMAIL"":"info@vinyasahealth.com"}"

  5. :arrow_forward:headers: Object

1. Content-Type: "application/json"

2. User-Agent: "Retool/2.0 (+https://docs.tryretool.com/docs/apis)"

3. X-Workflow-Api-Key: "---sanitized---"

4. ot-baggage-requestId: "undefined"

5. x-datadog-trace-id: "2581034863592262881"

6. x-datadog-parent-id: "2688768673185615975"

7. x-datadog-sampling-priority: "0"

8. x-datadog-tags: "_dd.p.dm=-1"

9. traceparent: "00-000000000000000023d1ad889550cce1-25506cdcd06d5067-00"

10. tracestate: "dd=t.dm:-1;s:0"

11. X-Retool-Forwarded-For: "49.36.81.89"

referring to @Darren's solution: Saving custom OAuth variables to DB for later access - #6 by Darren

I see he has used step1 in body params value. Can you exactly define what step1 is @Darren .

In that particular case, I used step1 just as a placeholder variable, but I'm pretty sure it was also an oauth block, in practice.

Just to see exactly what the API Request looks like, can you try changing the URL to hit https://darren.free.beeceptor.com instead of your workflow and then re-testing? For future reference, don't do this unless it's somebody that you trust. :sweat_smile:

1 Like

@Darren this is the api request in case of workflow

Yeah, exactly - I want to verify that the request is actually sending the authentication details to the workflow webhook. It's hard to tell otherwise when everything is sanitized.

1 Like

Upon changing the URL: this is the error I get

@Darren, I did manage to get the token values in API request body. however, the workflow issues still persists as it's giving me a new error:

  1. request: Object

  2. url: "https://api.retool.com/v1/workflows/7e9f7a9b-a146-4bc7-b0a2-f11d30ab433f/startTrigger"

  3. method: "POST"

  4. body: "{"accessToken":"hidden for security", "refreshToken":"hidden for security", "idToken":"hidden for security"}"

  5. :arrow_forward:headers: Object

1. Content-Type: "application/json"

2. User-Agent: "Retool/2.0 (+https://docs.tryretool.com/docs/apis)"

3. X-Workflow-Api-Key: "---sanitized---"

4. AUTHORIZATION: "---sanitized---"

5. ot-baggage-requestId: "undefined"

6. x-datadog-trace-id: "5408759249889046413"

7. x-datadog-parent-id: "3758318529459550475"

8. x-datadog-sampling-priority: "0"

9. x-datadog-tags: "_dd.p.dm=-1"

10. traceparent: "00-00000000000000004b0fc5e1853eaf8d-34283aca4534790b-00"

11. tracestate: "dd=t.dm:-1;s:0"

12. X-Retool-Forwarded-For: "49.36.81.89"

so, for understanding what might be causing the error, I removed email id variable from the api request. however, now this is the issue from workflow log.

insert into "Sucess_auth" ("access_token", "id_token", "refresh_token") values ($1, $2, $3) returning * - relation "Sucess_auth" does not exist

However running the block in the workflow in isolation without triggering the workflow from app, this is the repsonse

{"data":{"result":[{"id":64,"access_token":"{}","refresh_token":"{}","id_token":"{}","created_at":"2024-11-14T19:25:39.640Z","updated_at":"2024-11-14T19:25:39.640Z"}],"eventType":"CREATE_RECORD"}}

Here is the screenshot of the error we discussed during the office hour: @Paulo

Context: Once the resource is created, any further changes to the resource gives the above error.

the flow is all set but api response looks as follow:

can you please help, @Paulo :face_with_peeking_eye: