how to access authorization code using java ?

111 views
Skip to first unread message

heerend...@gmail.com

unread,
Apr 11, 2019, 1:15:10 PM4/11/19
to cerner-fhir...@googlegroups.com
  • Issue Summary: I am trying to access authorization code using java when i hit get request using HttpURLConnection,it redirect me to a login page,while i need to redirect my response to appended URL with authorization code so that i can get access token.
  • my code script is:-
URL siteURL = new URL(urlValue);
HttpURLConnection connection = (HttpURLConnection) siteURL.openConnection();
connection.setRequestMethod("GET");
                HttpResponse response = httpclient.execute(post);
String body = EntityUtils.toString(response.getEntity());
System.out.println(body);


Dennis Patterson (Cerner)

unread,
Apr 12, 2019, 11:12:49 AM4/12/19
to Cerner FHIR Developers
Do you have a redirect url?  After login, the authorization server will create your authorization code which will be provided to your redirect url as a query parameter.  Refer to this sequence diagram - http://hl7.org/fhir/smart-app-launch/#smart-authorization-sequence

In the example you give, you have "redirect_uri=", showing you're not providing a value.
Reply all
Reply to author
Forward
0 new messages