# Pack credentials not being passed to API

**URL:** <https://connect.superhuman.com/t/pack-credentials-not-being-passed-to-api/42379>\
**Category:** Making Packs\
**Created:** [August 24, 2023, 10:38pm UTC](https://connect.superhuman.com/t/pack-credentials-not-being-passed-to-api/42379 "2023-08-24T22:38:59Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mike\_Alvarez](https://yyz1.discourse-cdn.com/coda1/user_avatar/connect.superhuman.com/mike_alvarez/32/34155_2.png) [@Mike\_Alvarez](https://connect.superhuman.com/u/Mike_Alvarez)\
**Post date:** [August 24, 2023, 10:38pm UTC](https://connect.superhuman.com/t/pack-credentials-not-being-passed-to-api/42379/1 "2023-08-24T22:38:59Z")

</div>

I am stuck! Read all of the docs on auth, example, etc etc. Was able to get my first pack with makes a call to a third party service compiled and working but am getting “invalid credentials” from the response.

I have this section and I input my credentials from the Coda side:  
pack.setUserAuthentication({  
type: coda.AuthenticationType.WebBasic,

// Use placeholders for the username and password fields.  
uxConfig: {  
placeholderUsername: “User-ID”,  
placeholderPassword: “API-Key”,  
},  
});

My fetcher looks like this:  
let response = await context.fetcher.fetch({  
method: “POST”,  
url: “[https://my-api-url-here](https://my-api-url-here)”,  
cacheTtlSecs: 0,  
headers: {  
“Content-Type”: “application/json”,  
},  
body: JSON.stringify(payload),  
});  
console.log(payload);  
let data = response.body;

not sure what I am missing. Any help would be appreciated. I am trying to use basic auth and from what I can tell Coda does some encoding behind the scenes so i can’t print or view what is actually being passed.

I used postman with the same creds and was able to get this to work so I am pretty sure somewhere between the hand off from the coda doc to the API call… my creds are being dropped.

---

<div class="post-metadata">

**Author:** ![Eric\_Koleda](https://yyz1.discourse-cdn.com/coda1/user_avatar/connect.superhuman.com/eric_koleda/32/50286_2.png) [@Eric\_Koleda](https://connect.superhuman.com/u/Eric_Koleda)\
**Post date:** [August 24, 2023, 11:14pm UTC](https://connect.superhuman.com/t/pack-credentials-not-being-passed-to-api/42379/2 "2023-08-24T23:14:06Z")

</div>

Hi @Mike_Alvarez - Sorry to hear about the trouble! The code looks good at first sight, so not sure why you are getting that error. Have you looked at the HTTP logs in the Pack Makers tools?

> **[Pack maker tools - Coda Pack SDK](https://coda.io/packs/build/latest/guides/development/pack-maker-tools/#http-requests)**
>
> Utilities for Pack makers to helper them build and troubleshoot their Packs.

There you should be able to see more information about the outgoing request and if the API is returning a more specific error.

---

<div class="post-metadata">

**Author:** ![Mike\_Alvarez](https://yyz1.discourse-cdn.com/coda1/user_avatar/connect.superhuman.com/mike_alvarez/32/34155_2.png) [@Mike\_Alvarez](https://connect.superhuman.com/u/Mike_Alvarez)\
**Post date:** [August 25, 2023, 11:18am UTC](https://connect.superhuman.com/t/pack-credentials-not-being-passed-to-api/42379/3 "2023-08-25T11:18:44Z")

</div>

Thanks Eric! I have. Helpful but that is where I found the invalid credentials error: body:"\<?xml version=\"1.0\" encoding=\"UTF-8\"?\> \<messages recipientcount="1"\>2022Invalid Credentials "

I understand why I Coda redacts the user name and password but it there any way to validate what is being passed?

---

<div class="post-metadata">

**Author:** ![Bill\_French](https://yyz1.discourse-cdn.com/coda1/user_avatar/connect.superhuman.com/bill_french/32/49422_2.png) [@Bill\_French](https://connect.superhuman.com/u/Bill_French)\
**Post date:** [August 25, 2023, 1:11pm UTC](https://connect.superhuman.com/t/pack-credentials-not-being-passed-to-api/42379/4 "2023-08-25T13:11:21Z")

</div>

> [@Mike\_Alvarez](#):
>
> type: coda.AuthenticationType.WebBasic,

My money is on this. Are you certain this is the authentication type the endpoint supports?

---

<div class="post-metadata">

**Author:** ![Eric\_Koleda](https://yyz1.discourse-cdn.com/coda1/user_avatar/connect.superhuman.com/eric_koleda/32/50286_2.png) [@Eric\_Koleda](https://connect.superhuman.com/u/Eric_Koleda)\
**Post date:** [August 25, 2023, 1:41pm UTC](https://connect.superhuman.com/t/pack-credentials-not-being-passed-to-api/42379/5 "2023-08-25T13:41:22Z")

</div>

> [@Mike\_Alvarez](#):
>
> I understand why I Coda redacts the user name and password but it there any way to validate what is being passed?

No, unfortunately there isn’t any way to validate it except for the API working 😅 To Bill’s point, can you show us what your settings look like for Postman?

---

<div class="post-metadata">

**Author:** ![Mike\_Alvarez](https://yyz1.discourse-cdn.com/coda1/user_avatar/connect.superhuman.com/mike_alvarez/32/34155_2.png) [@Mike\_Alvarez](https://connect.superhuman.com/u/Mike_Alvarez)\
**Post date:** [August 25, 2023, 3:21pm UTC](https://connect.superhuman.com/t/pack-credentials-not-being-passed-to-api/42379/6 "2023-08-25T15:21:04Z")

</div>

Thanks guys for the engagement. Postman code snippet below. I changed the phone numbers as well as the encoded string (just in case) but you can see it is using basic.

var settings = {  
“url”: "[https://rest.clicksend.com/v3/sms/send?to=+11115551212&from=+18335551212&message=\](https://rest.clicksend.com/v3/sms/send?to=+11115551212&from=+18335551212&message=%5C)“Postman says hi"”,  
“method”: “POST”,  
“timeout”: 0,  
“headers”: {  
“Content-Type”: “application/json”,  
“Authorization”: “Basic bWlrZUBuZXV6ZWl0Z3-long-and-encoded-string-UU0QjJDRQ==”  
},  
“data”: JSON.stringify({  
“messages”: [  
{  
“body”: “post man text”,  
“to”: “+11115551212”,  
“from”: “+18331231234”  
}  
]  
}),  
};

$.ajax(settings).done(function (response) {  
console.log(response);  
});

The end point I am calling says the credentials should be in the URL or post body.

## Authentication

Your credentials should be used in the URL or the post body.  
username - Your API username key - Your API key

---

<div class="post-metadata">

**Author:** ![Mike\_Alvarez](https://yyz1.discourse-cdn.com/coda1/user_avatar/connect.superhuman.com/mike_alvarez/32/34155_2.png) [@Mike\_Alvarez](https://connect.superhuman.com/u/Mike_Alvarez)\
**Post date:** [August 25, 2023, 7:35pm UTC](https://connect.superhuman.com/t/pack-credentials-not-being-passed-to-api/42379/7 "2023-08-25T19:35:13Z")

</div>

Thanks for the responses @Eric_Koleda and @Bill_French. After going over this several times I finally discovered they changed the URL of their end point. They updated their postman files but not their documentation. It works now!

---

<div class="post-metadata">

**Author:** ![Eric\_Koleda](https://yyz1.discourse-cdn.com/coda1/user_avatar/connect.superhuman.com/eric_koleda/32/50286_2.png) [@Eric\_Koleda](https://connect.superhuman.com/u/Eric_Koleda)\
**Post date:** [August 25, 2023, 7:48pm UTC](https://connect.superhuman.com/t/pack-credentials-not-being-passed-to-api/42379/8 "2023-08-25T19:48:16Z")

</div>

Great sleuthing! It’s always something small and annoying like that. Glad you got it working!

---

<div class="post-metadata">

**Author:** ![zubair\_khan](https://yyz1.discourse-cdn.com/coda1/user_avatar/connect.superhuman.com/zubair_khan/32/42095_2.png) [@zubair\_khan](https://connect.superhuman.com/u/zubair_khan)\
**Post date:** [May 15, 2024, 1:27pm UTC](https://connect.superhuman.com/t/pack-credentials-not-being-passed-to-api/42379/9 "2024-05-15T13:27:00Z")

</div>

It sounds like you’ve made significant progress in setting up your pack, but you’re encountering issues with authentication and passing credentials to the API call. Let’s try to troubleshoot this together.

Firstly, ensure that the credentials you’re using (User-ID and API-Key) are correct and properly formatted. Double-check if there are any extra spaces or characters that might be causing authentication failures.

Next, let’s make sure that the authentication type and configuration are set up correctly in your pack. It looks like you’re using WebBasic authentication, which is suitable for basic authentication schemes. Make sure that the placeholderUsername and placeholderPassword match the field names expected by the API for authentication.

Since you mentioned that Coda might be encoding credentials behind the scenes, it’s essential to verify how the credentials are being passed in the actual API request. Unfortunately, as you mentioned, you can’t directly view the encoded credentials. However, you can check if the encoding process is causing any discrepancies between the credentials passed in Postman and those passed through your pack.

Lastly, consider reaching out to Coda’s support or community forums for further assistance. They might have insights or specific troubleshooting steps tailored to their platform that could help resolve the issue.

I hope these suggestions help you pinpoint and resolve the authentication issue. If you have any further questions or need additional assistance, feel free to ask!
