I can't use Flow variables as Credentials in Get Request nodes

Hi, I’m fairly new to Knime and I might have missed something obvious, but I can’t make an API Get Request with “dynamic” credentials.

I tried to use Flow variables, Flow variables to Credentials and NTLM credentials (as stated here : GET Request Authentication Credential Weirdness ) without any success.

And I don’t want to use Workflow credentials to set at each startup.

As soon as I remove the Password field from the Basic Authentication view the query fails with an 401 Not Authorized response.

Credentials hard-coded works


Credentials as Flow variable
image
image

Credentials as Variable to Credentials
image

NTLM
image
image

don’t works
image

Can anyone help me or tell me if this is a bug please ?

Thanks in advance

Bonus question : Can I use a variable (as soon as it works with this setup) in a Header value ?


Knime version : 4.5.0
on Ubuntu 20.04.3 LTS

image

1 Like

Hi @LoicCR and welcome to the Knime Community.

Have you been able to use the API outside of Knime? This is to make sure you are using the API correctly to begin with.

1 Like

Hi, thanks for your answer.
Yes, I can use the API with curl, Postman and from NodeJS, and as stated here I can even use it from Knime with the credentials hard-coded :

I double (and triple) checked my copy/paste of the username and password

Hi @LoicCR , could you show us how you are using it with cURL? What is the command that you are executing?

Hi @LoicCR , sorry I missed the part where you said that it worked in Knime when hardcoded (both in your latest post and in your first post).

The way you defined the variables and using them, it should have worked…

When you set up the Flow Variables in the GET Request node, do you see this message at the bottom?

EDIT: Ahhh, I see what’s the issue… Knime does not allow you to pass flow variables as password:
Attempt to overwrite the password with config key 'password' failed. It's not possible to overwrite passwords with flow variables.”

In that case, the workaround would be to use the Credentials object instead. You can do it like this:
image

Just add a Variable to Credentials node, and configured like this:
image

And in the GET Request, just use the Credentials option, and choose the Credentials object you set in the Variable to Credentials node like this:

3 Likes

@LoicCR I’ll take a wild guess and suggest to put your flow variables in quotes*. I had a similar problem in the past, but with the DB Query Reader:
I tried to use Flow Variables to parameterise my SQL statements in the DB Query Reader Node. It worked hardcoded, but not with Flow Variables. Turned out more quotes were needed because of how the values are injected. This looks awfully similar, might be the issue.

*normal double quotes, those guys: ""

1 Like

I did get this message.

That’s good to know, thanks.

That solved my issue.
For some reason I saw (and used) the Credentials option on the NTLM Tab, as it was specified in another forum post linked in my first message, but not in the Basic tab.
Silly me.

So here is the correct configuration

Thanks to everyone who took time to help me !

3 Likes

I didn’t need that but keep it in mind for next time.
Thanks

1 Like

Oh, and about my Bonus question ?
Is it possible to use a Flow variable / Credential variable in a Header value ?
Should I open a new Thread about that ?

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