Issue in freshservice Oauth

Hi,
TokenError: Client Authentication Failed
at OAuth2Strategy.parseErrorResponse (C:\Users\Benny Immanuel\AppData\Roaming\nvm\v18.16.0\node_modules\fdk\node_modules\passport-oauth2\lib\strategy.js:373:12)
at OAuth2Strategy._createOAuthError (C:\Users\Benny Immanuel\AppData\Roaming\nvm\v18.16.0\node_modules\fdk\node_modules\passport-oauth2\lib\strategy.js:420:16)
at C:\Users\Benny Immanuel\AppData\Roaming\nvm\v18.16.0\node_modules\fdk\node_modules\passport-oauth2\lib\strategy.js:177:45
at C:\Users\Benny Immanuel\AppData\Roaming\nvm\v18.16.0\node_modules\fdk\node_modules\oauth\lib\oauth2.js:191:18
at passBackControl (C:\Users\Benny Immanuel\AppData\Roaming\nvm\v18.16.0\node_modules\fdk\node_modules\oauth\lib\oauth2.js:132:9)
at IncomingMessage. (C:\Users\Benny Immanuel\AppData\Roaming\nvm\v18.16.0\node_modules\fdk\node_modules\oauth\lib\oauth2.js:157:7)
at IncomingMessage.emit (node:events:525:35)
at endReadableNT (node:internal/streams/readable:1359:12)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21)

I get this above error if I try Oauth with freshservice.

any help would be appriciated

Thank you.

image for your reference.

Hi @Freddy,

I’m encountering the above error while proceeding with OAuth in Freshservice.

Could you share your thoughts on this?

Thank you.

Hi Guys!

Greetings!

I above issue is fixed and I’m able to generate the token, but when I use the generated token I get 403 UnAuthorized Error.

Any help would be appriciated.

Thank you.

Hi Guys!

Any help would be appreciated…!

Hi @Bene_Immanuel,

Can you share the steps to reproduce the issue?

Hi @Raviraj,

Thanks for pitching in!

I have created the oauth in the developer config and created an fdk applicaiton in 3.0 for Fd and FS

And in the localhost I tried the Oauth and generated the token after the concent screen.

{
    "integrations": {
      "freshservice": {
        "display_name": "Freshservice",
        "client_id": "xxxx",
        "client_secret": "xxxx",
        "authorize_url": "https://<%= oauth_iparams.freshworks_org_domain %>/org/oauth/v2/authorize",
        "token_url": "https://<%= oauth_iparams.freshworks_org_domain %>/org/oauth/v2/token",
        "options": {
          "scope": "freshservice.agents.manage freshservice.agents.fields.view freshservice.products.view freshservice.tickets.create freshservice.tickets.view freshservice.tickets.edit freshservice.tickets.time_entries.view freshservice.tickets.time_entries.edit freshservice.tickets.fields.manage",
          "customHeaders": {
            "Authorization": "Basic (encoded value of client id ans secret)"
          }
        },
        "token_type": "account",
        "oauth_iparams": {
          "freshworks_org_domain": {
            "display_name": "Your Freshworks organisation domain",
            "description": "Enter your Freshworks organisation domain. For example, samplecompany.myfreshworks.com",
            "type": "text",
            "required": true
          },
          "freshservice_domain": {
            "display_name": "Your Freshservice domain",
            "description": "Please enter your Freshservice domain. For example: subdomain.freshservice.com",
            "type": "text",
            "required": true
          }
        }
      }
    }
  }

and this is the request I use

"getFreshserviceTicketFields": {
        "schema": {
          "method": "GET",
          "host": "<%= oauth_iparams.freshservice_domain %>",
          "path": "/api/v2/ticket_fields",
          "headers": {
            "Authorization": "bearer <%= access_token %>",
            "Content-Type": "application/json"
          }
        },
        "options": {
          "oauth": "freshservice"
        }
    },

and I get 403 error!

Thank you

Hi @Bene_Immanuel,

Can you try the following syntax with the uppercase B for bearer?

"Authorization": "Bearer <%= access_token %>"

When I used the lowercase, I also got the 403 error. This change works for me.

Hi @Raviraj,

Thank you for the reply.

Authorization":"Bearer fwoauth_ey.....

This is what I got from the log file, as we have discussed, Bearer & bearer both are not working for me!

Thank you.

@Bene_Immanuel I noticed that the API endpoint to get ticket fields is different in the docs.

Can you change the endpoint from “ticket_fields” to “ticket_form_fields” as follows and confirm if it works?

"getFreshserviceTicketFields": {
        "schema": {
          ...
          "path": "/api/v2/ticket_form_fields"
          ...
    },

This change resulted in success after getting 403 error from the previous endpoint.

Hi @Raviraj,

Thank you for your reply!

I’m still getting the 403 error! (after changing the endpoint)

Thank you.

@Bene_Immanuel Can you hard-code all the details to make the API once to see if it succeeds before using any templates?
Please ensure the relevant scope is added to the OAuth credentials used.

If it still fails, can you share all the required code once again?

Hi @Raviraj,

Still no luck!

Hi @Raviraj,

Greetings!

Was any fix implemented? I tried again this morning and received a 200 response.

Thank you so much for your assistance.