“Unable to sign without access token”

Hi everyone! So I do want to create a node which incorporates the Personio functionalities(in the declarative way). For testing I created a simple GET resource which uses an OAuth2 conn. First thing would be, is it possible to use the OAuth conn with the declarative type? Do you see any issues that might not allow this node to function correctly? Thanks in advance! Also the error message says: “Unable to sign without access token”…

separated git from hub cause of comunity rules =)

Hi @apopescu, I am not a node developer myself I am afraid but perhaps @marcus can help with this once he’s back from holiday?

Also, I’ve edited your post to include the actual link seeing you’re clearly not trying to spam the forum with shady links. Sorry for the trouble.

1 Like

Sounds good! Waiting for a response from Marcus. Thanks a lot !

1 Like

Hi @apopescu,
yes it is possible to use OAuth2 credentials with a declarative node type.

Looking at personio’s documentation I cannot see any mention that it is actually using OAuth2 to authenticate, even though it looks like it’s using client credentials. Their /auth endpoint requires to have client_id and client_secret as query params. If you are using n8n’s OAuth2 credentials you can choose to send credentials in the body or in the headers, but not as query parameters.

I also found this forum post about how to use Postman to make authenticated requests. Their solution was not to use OAuth2 but to use Pre-request Script to make an authentication call before each request.

At this point I am not sure if personio’s api is actually using standard OAuth2 client credentials authentication. Do you know any personio docs that actually mention that OAuth2 is being used?

2 Likes

Hi @marcus .Thanks for your answer! I do have some more questions tho(since using the Basic Auth in this case is out of my capability power). I want to access client_id and client_secret in personio.node.ts and I am trying to make 2 requests: the first one for get access token and the second one in which I do the operation in which the access token is attached. Is it possible to access client id and client secret in node.ts? Also you don’t have to put the client id and secret in qs. It also works in the body, even if the documentation gives an example with qs(tried in postman and it works in body). Why would the OAuth connection type not work even tho the client id and secret can be also send in the body of the request? Thanks in advance!

Hi @apopescu,
you should be able to implement your authentication inside your PersonioOAuth2Api.credentials.ts using an authenticate function.

The authenticate function will be executed each time your descriptive node makes an api request. You have access to the credentials and you can manipulate the requestOptions, i. e. setting headers or query parameters. Since personio seems to require requesting an access token before each api request, you could also do this inside the authenticate function.

Here are some n8n credential examples using the authenticate function:

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.