REST_Assured JIRA JAVA Integration | Loging | response | atl_Token Fetching

222 views
Skip to first unread message

Deepanshu Sagar

unread,
Sep 23, 2016, 10:06:23 AM9/23/16
to REST assured
Hello, 

Problem statement : use rest-assured to login intto JIRA Cloud using valid credentials, fetch authentication token, use that token to create a new test case in jira, fetch the test case DI from the response. 
tools: rest-assured api, java, maven. 

test case: 

@Test 
    public void LoginandFetchToken() throws Exception { 
        authentication = preemptive().basic("username", "password"); 
        try { 
            expect().statusCode(200).when().get("https://unitrends.atlassian.net/login"); 
        } finally { 
            RestAssured.reset(); 
        } 
        
        Response resp = given().contentType("application/x-www-form-urlencoded").
        when().contentType(ContentType.URLENC).post("https://unitrends.atlassian.net/login");
        System.out.println(resp.asString());
    } 

Expected output:  HTML Response to fetch atl_Token. 

Actual output: 

<p class="indra-signup">
                          <a href="/login/forgot" id="forgot" name="forgot">Unable to access your account?</a><br />
                          <span id="signup-disabled">To request an account, please contact your site administrators.</span>
                          <span id="signup-enabled">
                            <a href="/admin/users/sign-up">Create an account</a>
                          </span>
                      </p>

any help is much appreciated. 

Regards
Deepanshu

Johan Haleby

unread,
Sep 23, 2016, 10:09:23 AM9/23/16
to rest-a...@googlegroups.com
Is this service really using basic authentication? Looks to me that it's form authentication.

--
You received this message because you are subscribed to the Google Groups "REST assured" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rest-assured+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Piotr Klubinski

unread,
Oct 5, 2016, 1:39:14 AM10/5/16
to REST assured
I have a similar issue, but with CoreOS and Fleet.

Have you tried using proxy? Don't modify anything in your code, instal free edition of Burp Suite and configure it as your proxy.
For some reason this solved my problem (well, not really solved, but I'm getting a token).

Now I'm trying to figure out what is going on at proxy that it causes this to work...
Reply all
Reply to author
Forward
0 new messages