Skip to main content
Solved

Configuration of a token based WebConnection

  • September 20, 2023
  • 2 replies
  • 163 views

tschoppenhof
Contributor
Forum|alt.badge.img+7

I wan to connect to a REST-API with a WebConnection (Token Service), but it doesn't work with the paramters i use. The same parameter in a HTTPCaller are working. Any Idea whats wrong? The token is assingned to the key "jwt". I use FME 2023.1.

 

Example Settings for the HTTPCaller

Request URL: https:www.test-example.com/backend/api/AUTH/login

HTTP Method: POST

Headers: Accept text/plain

Upload Body: {"email":username@test.com, "password":"12345"}

Content Type: JSON (application/json)

 

And the answer looks like

(the values are not real)

 

{

               "user": {

                              "id": "123qw14-a666-222e-777a-a123fg2f12ad",

                              "email": "usename@test.com",

                              ...

               },

               "jwt": "0a80da980d80a7f7sd073",

               "userConfiguration": null,

               "globalConfiguration": {

                              "tileApiKey": "123sdgf43254e6sZZU347"

               },

               "maxTables": 8,

               "maxColumns": 50,

               "language": null

}

My Web Connection Settings are like this:

Request URL: https:www.test-example.com/backend/api/AUTH/login

Request Data: email[username@test.com]&password[12345]

Token Object Key: jwt

Placement: Header

Header Format: Authorization: Bearer [jwt]

Best answer by virtualcitymatt

Here's one which I've configured in the past which works

 

image 

It might be you need to change the structure of the Request Data to be JSON so it matches the POST body.

 

You may also need to change your Token Object Key from "jwt" to serviceResponse.jwt

 

The header format should use the TOKEN keyword I think rather than "jwt".

 

I notice in the response there is no expiry for the token - I'm not sure if FME requires/expects it.

 

 

Do you have access to the host to see the requests coming in to see if the structure is correct?

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

2 replies

virtualcitymatt
Celebrity
Forum|alt.badge.img+47
  • Celebrity
  • Best Answer
  • September 20, 2023

Here's one which I've configured in the past which works

 

image 

It might be you need to change the structure of the Request Data to be JSON so it matches the POST body.

 

You may also need to change your Token Object Key from "jwt" to serviceResponse.jwt

 

The header format should use the TOKEN keyword I think rather than "jwt".

 

I notice in the response there is no expiry for the token - I'm not sure if FME requires/expects it.

 

 

Do you have access to the host to see the requests coming in to see if the structure is correct?


tschoppenhof
Contributor
Forum|alt.badge.img+7
  • Author
  • Contributor
  • September 20, 2023

Hey virtualcitymatt

 

Thanks a lot. You were absolutely right, changing the request aus you suggest, did the trick. The expiry Time is not necessary.