<iframe src="https://www.googletagmanager.com/ns.html?id=GTM-M74D8PB" height="0" width="0" style="display:none;visibility:hidden">
Loading
Skip to NavigationSkip to Main Content
0D50Z00008G7V5XSAVOkta Classic EngineIntegrationsAnswered2024-03-25T19:37:52.000Z2016-11-25T20:15:30.000Z2016-11-25T20:15:30.000Z
How to programmatically login to application?

I have created an integration test framework to test an application we wrote.  Several instances of this application use Okta for login.  I'm trying to add support for logging in via Okta to our test framework.  

 

First, there is no actual browser involved.  We are using Apache Http Client to test our deployed client.

 

What I have been able to do so far is this:

 

1) Using the Java SDK I've called AuthApiClient.authenticate to get a valid session token.

 

2) I've done an http GET request to our Okta app EMBED LINK URL with "?onetimetoken={sessionToken}" appended to the Okta URL.

 

3) This responds with some HTML that has a form in it with an id of "appForm".

 

4) We are not executing JavaScript in HTML because we are just getting the content using http client.

 

5) I'm able to extract the data from the form, this includes the SAML Response.

 

6) I'm able to call an HTTP Post with the data from that form which logs me into the application.

 

This all seems rather dirty when we get to the HTML portion.  Is there a non JavaScript way of doing this? Or, conversly is there a way of getting the SAML Response in Json format so I don't have to parse apart HTML?

 

Or, faily all that, is there a completely different way of logging into an application without using a browser all together?

 

Thanks.

 

 

 

 


This question is closed.
Loading
How to programmatically login to application?