I do I authenticate with an experience endpoint using Postman?
Hey @Lars_Andersson,
In Postman, you can send a post request to an experience with the following URL (you’ll replace APPID with your experience app id): APPID.onlosant.com/myCustomAuthEndpoint
You can either send the authentication token in the URL, or in the body of the request. The User Authentication section of the How to Build an Experience API guide is a great resource for building the endpoint itself.
You can check out Passing Authorization Tokens in our docs. But below I’ve included an image for each of the options I gave above.
For these to work, you will need to update the authentication node in your workflow to accept the values you send since they are in specific places in the payload.
Thank you,
Heath
Thanks, I got a few steps further.
When looking at the returned data in Postman from data,responseuser, I see a time value for “tokenCutoff”. Should that match based on the TTL time I enter in Max-Age for Token generation in the Authentication Node?
Hey @Lars_Andersson
You can find more information about the auth token in the authInfo
object of the response. tokenCutoff
is in the user
object.
Here’s what the authInfo
object looks like:
"authInfo": {
"issuedAt": "2020-07-09T14:21:07.000Z",
"expiresAt": "2020-07-09T14:26:07.000Z"
}
There you can see the time at which the token will expire.
Thank you,
Heath
I can not find that in the object of response.
The only authInfo I can find is under experience and it shows null.
Hey @Lars_Andersson,
I’m looking into reproducing this on my end. I’ll update this thread when I have a better answer for you!
Thank you,
Heath
I want to be sure I’m approaching your question correctly, could you please send me the workflow you’re sending the request to? Either a screenshot or a zip file are fine.
Thank you so much,
Heath
get-apitest-develop.zip (1.1 KB)
I notice workflow is named GET and the first trigger node in the workflow is configured for a post request, are you making the correct HTTP request type when triggering this workflow?
Also, I was able to get this working on my end. The only thing I needed to change was to turn {{data.body.data.email}}
into {{data.body.email}}
. This is because of the structure I’m sending in Postman, it’s not a nested object. Here’s what that looks like:
Could you send me the format of the payload you’re sending in Postman OR a screenshot of your workflow debug when this workflow is triggered?
Thanks,
Heath
I was using POST from Postman…
It was authenticating, but I couldn’t see any authInfo returned.
In your workflow, on successful authentication, you’re sending your own body data.
Because you have configured this to send specific data, you will need to include any values you would like to send in the response body. To send the whole response, you can replace what you have in the Response Body Template with {{.}}
. If you would like to additionally send the authInfo
with what you have now, you will need to include it as another JSON key and value.
Heath