simple-oauth2 icon indicating copy to clipboard operation
simple-oauth2 copied to clipboard

Access to the full request object returned from getToken(...)

Open ZacharyDuBois opened this issue 1 year ago • 0 comments

Context

  • node version: v21.6.1
  • module version: ^5.0.0
  • environment (e.g. node, browser, native): node
  • any other relevant information:

What problem are you trying to solve?

Access full request object from .getToken() call. Acumatica has a pretty messed up OAuth flow to where you get a session id as a Cookie on the token request. You need to get this so you can later log out the session as required by their licensing. Sadly they do not track it by access tokens.

I understand this is pretty specific to one platform's bad implementation of OAuth (and API's in general). But I could see other uses for getting full response data returned.

Do you have a new or modified API suggestion to solve the problem?

Right now, I have extended a few classes to have the Client.request(...) return the full response object. Then modified the ResourceOwnerPassword.getToken() to stitch the Set-Cookie header into the AccessToken object. A bit messy but it worked.

Their API has been an absolute PITA. 500 is really a 404...etc. Bad practices all over.

ZacharyDuBois avatar Feb 16 '24 15:02 ZacharyDuBois