Forum Discussion

fuenteso's avatar
fuenteso
Leader
7 years ago

Get query parameters from http.client.response

Hi everyone,

 

I'm trying to integrate data from an internal user profile application and I need to get an authentication code from our share SSO environment. I'm using http.client to make the request on an endpoint. So I make the request, the SSO environment validates that there's an active session and redirects me to a non-lithium URL (the application URL) with the authorization code embeded as a query parameter.

 

The problem is that I can't find a way to retrieve that query parameter or the redirect URL from http.client.response. I can only get the page content (is a blank page) and the response headers.

 

Do you know if there's a way to get the redirect URL from the context object? Has anyone tried to authenticate via OAuth 2.0 (and OpenID) to a "third party" application?

 

Thanks!

  • fuenteso - I believe we only can get the response data, not the response URL. Also, is there no content on the login page? because as you said, you get a blank page?

     

    There are few context object available, however, these are for getting the redirection URL for lithium SSO page.  e.g

     

     ${webUi.getUserLoginPageUrl("/")}

    ${webUi.getUserLogoutPageUrl("/")}

    ${webUi.getUserRegistrationPageUrl("/")}

     

    Documentaion: https://freemarker-docs-portal.lithium.com/refer/contextObjects

    • fuenteso's avatar
      fuenteso
      Leader

      Hi,

       

      Well, the original process is we redirect the user to the log in page and provide a callback URL, once the user logs in the authentication server redirects the user back to the callback URL including an authorization code that we should exchange for an access token. 

       

      In this case the callback URL is a dummy page, we need to pick up that access code and make another call to the User profile service so they can exchange it for the access token and grant us access to their data.

       

      I guess I'll have to find a different way to authenticate.

       

      Thanks anyway.