Skip to main content

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 ejwt]

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?


Hey virtualcitymatt

 

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


Reply