Android Retrieve Zoom Access Token Failure

I am following this documentation: and I successfully got the JWT and tried it on to see if the token works and it did.

Now my problem is when I use this JWT to retrieve a Zoom Access Token (ZAK). I get a -1 in the connection.getResponseCode() meaning it will just go to the else statement. I simply just followed the code in the documentation and replaced it with my own variables.

try {
        URL zoomTokenEndpoint = new URL("" + userId + "/token?type=zak&access_token=" + jwt);
        HttpsURLConnection connection = (HttpsURLConnection) zoomTokenEndpoint.openConnection();

        if(connection.getResponseCode() == HttpsURLConnection.HTTP_OK)      //I get response code of -1 here
            InputStream responseBody = connection.getInputStream();
            InputStreamReader responseBodyReader = new InputStreamReader(responseBody, "UTF-8");
            BufferedReader streamReader = new BufferedReader(responseBodyReader);
            StringBuilder responseStrBuilder = new StringBuilder();

            //get JSON String
            String inputStr;
            while((inputStr = streamReader.readLine()) != null)
            JSONObject jsonObject = new JSONObject(responseStrBuilder.toString());
            return jsonObject.getString("token");
        }else {
            System.out.println("Error in connection");;
            return null;
    } catch (Exception e) {

I got it guys. The problem is I’ve used the APP_KEY and APP_SECRET to generate the JWT. The one needed to generate the JWT is the API key and API secret. So basically you need 4 constants: App key/ SDK Key, App Secret / and the SDK Secret for initialization, API key, and API secret for the generation of JWT.