Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

Download tool example using username & password from yxdb and basic authentication

patgarner
5 - Atom

There are 5 parts to this example:

 

  1. UrlUsernamePassword.yxdb

    Stores 1 record with 3 fields: url, username, password
    Currently contains values that need to be replaced with valid url, username, password in order to test the example.

    patgarner_1-1686854780738.png

     

  2. UpdateUrlUserPassword.yxmd

    Used to update the yxdb, above
    patgarner_2-1686855348770.png

  3. BasicAuthenticationViaHeaders.yxmc

    This macro takes 3 inputs:  url, username, password
    Connects using the Authorization: Basic header

    patgarner_3-1686855412925.png

     

  4. BasicAuthenticationNoHeader.yxmc

    This macro takes 3 inputs:  url, username, password
    Connects to the target server using basic authentication without the Authorization header, instead using an Action to update the username and password directly into the Download Tool's UserName and Password attributes.

    patgarner_4-1686855705071.png

     

  5. TestMacros.yxmd

    Connects the UrlUsernamePassword.yxdb as an input to each of the above macros in order to test them.
    patgarner_5-1686856029390.png

    When I test against a known working endpoint using a valid url, username, password I receive the following:

    Status: "401"
    Message:  "Authentication failed. Provide a valid user ID and password."

    When I say "known working endpoint" I mean that I can successfully connect to the endpoint using the Alteryx Download tool in the conventional way, which confirms that url, username, and password are correct.

    patgarner_6-1686856489032.pngpatgarner_7-1686856535763.png

     

    Can someone take a look at this and help me understand why my example is not working?  Thank you!!


6 REPLIES 6
geraldo
13 - Pulsar

@patgarner 

 


you use this information in the header

You have to enter in name Authorization

and generate the user and password in base64 as follows
user:password
and in value put Basic <base64 user:password>
and take it from the connection tab

 

you can use the python tool or on a site that converts text to base64 to do the test

 

e,g, user joshua

pasword=password

 

joshua:password

em base64 = am9zaHVhOnBhc3N3b3Jk

 

geraldo_0-1686859927322.png

 

apathetichell
18 - Pollux

action tools in your noheader macro leading into your download tool are configured wrong. you want to replace the values in username and password - not username and password. add dummy values and then reset the action tools to replace those values. password will be at the top of the action tool vs where it appears in the tool itself. you may need to encrypt.

patgarner
5 - Atom

Thanks @apathetichell

 

I put dummy values in the Download tool

 

patgarner_0-1686936512645.png

 

and reset the action tools to point to the values.  Here's update username action

 

patgarner_1-1686936707875.png

 

Here's update password action:

 

patgarner_2-1686936749291.png

 

But I still got the 401 response.  So I updated UpdateUrlUserPassword.yxmd to base64 encode the password

 

patgarner_3-1686937891342.png

 

and in TestMacros.yxmd I remapped the input of the macro to receive the encoded password

 

patgarner_4-1686938124759.png

 

And I still got a 401 response. 

 

Any other ideas?  I've attached the updated files.

 

 

patgarner
5 - Atom

Thanks @geraldo.  Here is where I put Basic <base64 user:password>

patgarner_1-1686939119379.png

 

and below is where I prepare the Authorization header.  Note that I do not enter a constant header value like you did in your example.  I use the value from the Authorization field I create in the above macro so that the password can be changed dynamically upstream.

 

patgarner_2-1686939248979.png

 

 

And to confirm what you said, no, I did not put username or password in connection tab:

 

patgarner_3-1686939380477.png

 

Please correct me if I'm wrong but I think I already did what you said. 

 

apathetichell
18 - Pollux

@patgarner two things:

 

1) get your macros working with template data prior to running your entire workflow. ie make sure your original/set values work - this will help in your troubleshooting.

2) I do not believe passwords will need to be encoded prior to passing via the action tool.

 

I guess one more - my hunch is either the FTPs are not working - or there is still something off on one of your action tools. I'd strongly recommend checking these individually and working on troubleshooting that first.

patgarner
5 - Atom

@apathetichell Your hunch was right about the endpoint itself not working properly.  I created my own endpoint configured with basic authentication and both macros (headers and no headers) worked properly.  So all is good. 

 

And you were also right that the password didn't need to be encoded in the no-header solution.

 

Of the 2 macros, I learned to prefer the with-header solution because Download doesn't send the Authorization header if it's not explicitly defined. So, the no-header solution results in a 401/unauthorized on the 1st request. 

 

patgarner_1-1687205744057.png

 

 

But then Alteryx sends a 2nd request that contains the header, and the response is 200 ok.  So 2 requests are made each time the no-header workflow is run whereas the with-header solution does not have this problem.

 

Thanks a bunch for your help 🙌 🙏

Labels