Error: 403 Forbidden while using GET Request node.

The credentials are working fine when i tested on POSTMAN. But in KNIME when I use Get request node its giving me error 403.

@sumit_bhangu,

Please check your credentials during configuration, as a 403 error indicates an authorization issue.

https://www.hostinger.in/tutorials/what-is-403-forbidden-error-and-how-to-fix-it#:~:text=403%20Forbidden%20is%20a%20standard,user%20experience%20and%20bounce%20rates.

2 Likes

@tqAkshay95

I tested with these credentials in postman. Its working fine

1 Like

@sumit_bhangu ,

can you provide configuration window ?

Even not able to access public API which are without any key

I just searched for a random public api: https://alexwohlbruck.github.io/cat-facts/

Worked fine for me… can you try this on your end?

2 Likes

@sumit_bhangu,

yes, the API provided by @MartinDDDD also worked for me.

ok I experimented a bit to get to the bottom of this.

I tried to get data from this dummy API: Auth - DummyJSON - Fake REST API of JSON data for development
((https://dummyjson.com/docs/auth) )

Using the credentials in this example:

fetch('https://dummyjson.com/auth/login', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    
    username: 'emilys',
    password: 'emilyspass',
    expiresInMins: 30, // optional, defaults to 60
  })
})
.then(res => res.json())
.then(console.log);
  1. validated that it works when running the script from html => object received successfully
  2. converted to simple python script and ran via Python Script node => object received
  3. used credentials in Get Request node (Basic, Digest) ==> 403

Then I tried the basic test endpoint via get request which does not require Auth: [Preformatted text](https://dummyjson.com/test)

Little bit lost at this stage but maybe this can help further investigation.

One thought after reading through the description: Does Get Request include the credentials always in Header? If so that may be the cause as the API above expects username / password in Body.

Hint: In Node config check this box:

That at least gives a hint…

image

2 Likes

@MartinDDDD

I tired the public API you provided but it did not worked for me. But the same APIs I tested with same configuration are working fine on my Colleague’ s Machine

Ok that is weird - at least that suggests that this is not necessarily caused by KNIME but something related to your machine / KNIME installation specifically.

Can you share how you are authenticating? Via bearer token in header or via credentials in body of the request?

I came across this thread: request body for get request node - #4 by qqilihq

Which suggests that Get Request node can not pass anything in request body (which is likely why my attempt at dummyjson.com did not work via Get Request, but via Python Script Node).

For now I’d suggest you either test Python Script and potentially consider doing your request via Python as a work around.

This simple script should help you validate if it works via Python:

import requests
import json

url = 'https://dummyjson.com/auth/login'
headers = {'Content-Type': 'application/json'}
data = {
    'username': 'emilys',
    'password': 'emilyspass',
    'expiresInMins': 30  # optional, defaults to 60
}

response = requests.post(url, headers=headers, data=json.dumps(data))
print(response.json())

Put it into a Python Script Node and Run All - you should see a JSON object printed in console like this:

1 Like

Hi @MartinDDDD

I am using Bearer Token. The same configuration of Get Request node worked fine on my colleague’s machine

As I mentioned I’m afraid this might be related to your computer / set up if the same operation is working on your colleagues machine. Unsure on what I can do further to help debug…