[Data Grid] Consume protected API

Forge Component
(36)
Published on 17 Mar (12 days ago) by OutSystems R&D
36 votes
Published on 17 Mar (12 days ago) by OutSystems R&D

Hi,

We have a secured API and need to include Authorization header to request. How should I pass this header (or any other) to "RestURL " attribute? 

Thank you

Hi Mykola,

I think that's a non-supported scenerio. However, as a work-around you could create a local proxy REST service that consumes the secured API, passing along the input and output.

Hi Killian. 

What do you mean by local proxy REST? Expose unprotected API that makes call to protected API via OS Consume Node passing all needs headers? 

Hi,

What we did was to make a protected REST call on the preparation to create a token and than we use that token to call the rest of the grid.

Regards,

Marcelo

Mykola (Nick) Tkachenko wrote:

What do you mean by local proxy REST? Expose unprotected API that makes call to protected API via OS Consume Node passing all needs headers? 

Yes, that's what I had in mind. To make it more secure, you can add "local" security like Marcelo described.


Marcelo Ferreira wrote:

Hi,

What we did was to make a protected REST call on the preparation to create a token and than we use that token to call the rest of the grid.

Regards,

Marcelo

I have a token generated on preparation, How should I pass add it to RestURL as Authorization header? 


Hi,

So you called the protected REST and it returns a token that was saved on the DB of that module. Than you can call the grid REST with the token as parameter. The grid REST will check the db if the token exists and didn't expire. the Expiration date can be just a couple of seconds.

Regards,

Marcelo

So token will be sent in URL as a parameter? 

In this case we can't just use oAuth2 component as it checks  https://www.outsystems.com/forge/component-overview/3573/oauth2-provider

Can we somehow use local text variable instead of grid RestURL ?

Hi,

I didn't find a way of doing it. Even if is not ideal for us we still use REST URL's when using data grid. Maybe if you change the Data Grid itself.

Regards,

Marcelo