Skip to content

Commit 8a12999

Browse files
authored
patch oAuth sample custom challengehandler (#366)
* implement fix for javafx webengine * formatting * add fix for create and save map sample * markdown to html formatting
1 parent 61c2af9 commit 8a12999

File tree

4 files changed

+11
-2
lines changed

4 files changed

+11
-2
lines changed

src/main/java/com/esri/samples/map/create_and_save_map/OAuthChallengeHandler.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public AuthenticationChallengeResponse handleChallenge(AuthenticationChallenge c
5454
// get the authorization code by sending user to the authorization screen
5555
String authorizationUrl = OAuthTokenCredentialRequest.getAuthorizationUrl(
5656
config.getPortalUrl(), config.getClientId(), config.getRedirectUri(), 0);
57-
String authorizationCode = OAuthChallenge.getAuthorizationCode(authorizationUrl);
57+
String authorizationCode = OAuthChallenge.getAuthorizationCode(authorizationUrl + "&display=classic");
5858

5959
// use the authorization code to get a token
6060
OAuthTokenCredentialRequest request = new OAuthTokenCredentialRequest(

src/main/java/com/esri/samples/map/create_and_save_map/README.md

+5
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,8 @@ chosen folder.</p>
4040
<li>PortalItem</li>
4141
<li>PortalUserContent</li>
4242
</ul>
43+
44+
45+
<h2>Additional information</h2>
46+
47+
<p>The JavaFX <code>WebEngine</code> used in the <code>OAuthChallengeHandler</code> in this sample may not support rendering of some modern web elements returned by the <code>AuthorizationURL</code>. For this reason, we append <code>&display=classic</code> to the authorization URL, to ensure it renders properly.</p>

src/main/java/com/esri/samples/portal/oauth/OAuthChallengeHandler.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ static String getAuthorizationCode(String authorizationUrl) throws Exception {
9191
dialog.setScene(new Scene(browser, 450, 450));
9292
dialog.show();
9393
WebEngine webEngine = browser.getEngine();
94-
webEngine.load(authorizationUrl);
94+
webEngine.load(authorizationUrl + "&display=classic");
9595

9696
// read the HTTP response to user action
9797
webEngine.setOnStatusChanged(event -> {

src/main/java/com/esri/samples/portal/oauth/README.md

+4
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,7 @@ access token. This access token is used later to access user's profile.</p>
3636
<li>Portal</li>
3737
<li>PortalUser</li>
3838
</ul>
39+
40+
<h2>Additional information</h2>
41+
42+
<p>The JavaFX <code>WebEngine</code> used in the <code>OAuthChallengeHandler</code> in this sample may not support rendering of some modern web elements returned by the <code>AuthorizationURL</code>. For this reason, we append <code>&display=classic</code> to the authorization URL, to ensure it renders properly.</p>

0 commit comments

Comments
 (0)