Storing auth key obtained from POST message

Ahmad6
Giga Expert

Hi guys,

I've got a platform I'm integrating with which provides an authentication endpoint where you pass in username/password and a key in the body and it returns a token with 1 hour expiry time. Because of the additional key in the body I can't use a basic profile and when I tried to set up OAuth something's not right because I get {"Message":"The requested resource does not support http method 'GET'."} when trying to get the token that way.

 

I can get the key via a POST REST message and I'm wondering is there a place I can store this key along with an expiry time so that I can re-use it globally until the token expires? I know I'm basically reverse-engineering the OOB functionality here but I'm working with a slightly different scenario to what I normally do. Worst case scenario I may just create an API Key credential that I update using script includes but I would prefer if there was a way that couldn't be tampered with.

1 ACCEPTED SOLUTION

Soeren Maucher
Mega Sage

Hello @Ahmad6

 

if you use the OOB OAuth setup, the system stores the token in the following table: oauth_credential. 
I guess in you case, you could just store the token there as well and then retrieve it each time you do an API call. The table already provides an "expires" field. 

I hope this helped! 

Greetings, 
Sören

View solution in original post

2 REPLIES 2

Soeren Maucher
Mega Sage

Hello @Ahmad6

 

if you use the OOB OAuth setup, the system stores the token in the following table: oauth_credential. 
I guess in you case, you could just store the token there as well and then retrieve it each time you do an API call. The table already provides an "expires" field. 

I hope this helped! 

Greetings, 
Sören

Hi Soeren,

 

Thanks for that, do you know if the record gets deleted at the expiry time automatically? I want to know if I should be re-using the credential record or I can just query the table for it and make a new one when it disappears.