Skip to main content
Question

FME Workspace App, FME Rest API & Credentials


ebygomm
Evangelist
Forum|alt.badge.img+54

If you have a workspace app that requires authorisation, which runs a workspace that makes a http call to the FME Rest API, is it possible to use the logged in user to authenticate the http request?

3 replies

nickcumming
Safer
Forum|alt.badge.img+12

Hi @ebygomm, good question.  

The short answer is no.

  • Using a private Workspace App end user to directly authenticate an API call: The signed-in user's session or token isn't passed to the workspace from the app, so an HTTPCaller can't directly authenticate with the end users tokens.

There may potentially be some creative solutions in FME Form that could meet your needs.

If calling the API as the end user is a hard requirement and there are no solutions that come up, it'd make a good Ideas post.

Let me know if I can help!


todd_davis
Influencer
Forum|alt.badge.img+23

Creative solution ahead…

As mentioned the app doesn’t pass through the users authentication details and getting the session token in app is very yuck and you will be jumping through hoops.

 

But I think you can do this, by being a bit tricky. 

In your workspace that is call by the Flow App, you call make a call  with an account with significant rights.

  1. Get the User id based on the Runtime user
  2. Use the User id inside a call to get an FME Flow api token with custompermission = false

That token returned now inherits the permissions of the specific runtime user and appears 

  1. Use the token in the call to the Rest API endpoint you are interested in
  2. Then delete the token….API tokens without custom permission should not be left around.

 

Here is an example of me making a token, using a admin login, to create a token for the guest and what is viewable under the guest login, and it inherits the permissions of what the guest account normally has (not the admins permissions).

 

Just need to make sure you take any security consiuderations into account.


zoe.forbes
Safer
Forum|alt.badge.img+10

Hi all, 

I agree with ​@todd_davis’ solution being a good approach! For others’ reference, you can obtain the authenticated user’s ID via FME Flow Parameters:

You can also save a transformer by setting a very short secondsToExpiry when creating the token, instead of manually deleting it.