How to get the token response with post API

I have this endpoint and data body working on POSTMAN and I tried the approach that was listed on the wappler docs/community about how to get a response from the POST API.

These are sample datas that I’m using:
image

and when I fetch the API action this is what it says:
image

I also put the 5 datas on input datas on Wappler

what’s the type of auth you are using in api as well as in postman?

Here is an example of how I authenticate.
sometimes you have combine the user and password info and then encrypt it to base 64. I create variables to combine and then encrypt. You have to make sure that output is checked for each of the variables.

1 Like

If you are doing basic auth in Postman then you need to combine username and password and then encrype. Postman does it for you automatically. Need to set it up in wappler.

I have finally fetched the results by doing this thank you. I would also love to ask if how would I get the response from this to the frontend. I would love to put it onto a session storage if possible

I have finally fetched the results by doing this. I would also love to ask if how would I get the response from this to the front-end. I would love to put the result of my access token from my server/workflow apiAuthenticate TO my headers in my API data source. Is that possible?

the apiAuthenticate results are not on my data bindings for my api data source.

thank you! @baub

1 Like

Did you get this all worked out? to get the result returned with what you need? Usually you have to retrieve the schema from the API and then it will show up in the picker to use that data. Let me know if you are still having an issue?

Hi yes Baub,

I have retrieved the API response on the client side. But my only problem is that whenever I call that response to my API headers, the value is not populating. Any reasons why? @baub

On wappler:
image

On browser network:
image

Are you calling that from the client side? Is that in a flow? You probably need to generate your access token for each api call?

Maybe just create a H1 or paragraph tag and add the {{flow1.data.apiAuthenticate.data.access_token}} to see what that is actually returning. Because your authorization should look something like Basic xxxxxxxxxxxxxxxxxxxxxx etc. if its just the xxxxxxxxxxxx part then it wouldn’t authorize?