Skip to content
This repository was archived by the owner on Jun 16, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion msal-client-credential-certificate/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ The relevant code for this sample is in the `ClientCredentialGrant.java` file.
In this case calling "https://graph.microsoft.com/v1.0/users" with the access token as a bearer token.

```Java
URL url = new URL("https://graph.microsoft.com/v1.0/users");
URL url = new URI("https://graph.microsoft.com/v1.0/users").toURL();
HttpURLConnection conn = (HttpURLConnection) url.openConnection();

//...
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.nio.file.Files;
import java.nio.file.Paths;
Expand Down Expand Up @@ -82,8 +84,8 @@ private static IAuthenticationResult getAccessTokenByClientCredentialGrant() thr
return future.get();
}

private static String getUsersListFromGraph(String accessToken) throws IOException {
URL url = new URL("https://graph.microsoft.com/v1.0/users");
private static String getUsersListFromGraph(String accessToken) throws IOException, URISyntaxException {
URL url = new URI("https://graph.microsoft.com/v1.0/users").toURL();
HttpURLConnection conn = (HttpURLConnection) url.openConnection();

conn.setRequestMethod("GET");
Expand Down
2 changes: 1 addition & 1 deletion msal-client-credential-secret/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ The relevant code for this sample is in the `ClientCredentialGrant.java` file.
In this case calling "https://graph.microsoft.com/v1.0/users" with the access token as a bearer token.

```Java
URL url = new URL("https://graph.microsoft.com/v1.0/users");
URL url = new URI("https://graph.microsoft.com/v1.0/users").toURL();
HttpURLConnection conn = (HttpURLConnection) url.openConnection();

//...
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.util.Collections;
import java.util.Properties;
Expand Down Expand Up @@ -65,8 +67,8 @@ private static IAuthenticationResult getAccessTokenByClientCredentialGrant() thr
return future.get();
}

private static String getUsersListFromGraph(String accessToken) throws IOException {
URL url = new URL("https://graph.microsoft.com/v1.0/users");
private static String getUsersListFromGraph(String accessToken) throws IOException, URISyntaxException {
URL url = new URI("https://graph.microsoft.com/v1.0/users").toURL();
HttpURLConnection conn = (HttpURLConnection) url.openConnection();

conn.setRequestMethod("GET");
Expand Down