0

I'm trying to get a token from my GitHubApp using the step by step tutorial on GitHub.

Step 1 is to get the code with http GET https://{GitHubEntreprise}/login/oauth/authorize

        URL url = new URL("https://{GitHubEntreprise}/login/oauth/authorize");
        HttpURLConnection con = (HttpURLConnection) url.openConnection();
        con.setRequestMethod("GET");

        Map<String, String> parameters = new HashMap<>();
        parameters.put("client_id", "Iv1...");
        ParameterStringBuilder parameterStringBuilder = new ParameterStringBuilder();
        con.setDoOutput(true);
        DataOutputStream out = new DataOutputStream(con.getOutputStream());
        out.writeBytes(parameterStringBuilder.getParamsString(parameters));
        out.flush();
        out.close();
        con.getResponseCode();

The response code is 403. Trying to call it by Postman and it return me a html page... i don't really understand.

The goal of this subject is to be able to read a file on a private git hub organisation

Have you got an idea ?

amalicode
  • 37
  • 1
  • 8

0 Answers0