There are 5 parts to this example:
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.
Can someone take a look at this and help me understand why my example is not working? Thank you!!
Solved! Go to Solution.
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
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.
Thanks @apathetichell
I put dummy values in the Download tool
and reset the action tools to point to the values. Here's update username action
Here's update password action:
But I still got the 401 response. So I updated UpdateUrlUserPassword.yxmd to base64 encode the password
and in TestMacros.yxmd I remapped the input of the macro to receive the encoded password
And I still got a 401 response.
Any other ideas? I've attached the updated files.
Thanks @geraldo. Here is where I put Basic <base64 user:password>
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.
And to confirm what you said, no, I did not put username or password in connection tab:
Please correct me if I'm wrong but I think I already did what you said.
@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.
@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.
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 🙌 🙏
Can you paste the final workflow and macros here?