I’m trying to get access token with following code snippet, which is workable one year ago.
But it failed with error "Non-global clients are not allowed access to APIv1"
, what does “Non-global clients” mean and how to workaround it.
JSONObject jsonObject = new JSONObject();
jsonObject.put("client_id", "Qztgs5JefLiBKwu3jzfnRTG8uqyZUoel");
jsonObject.put("client_secret", "***************************");
jsonObject.put("grant_type", "client_credentials");
HttpPost post = new HttpPost("https://lcheng.auth0.com/oauth/token");
post.setEntity(new StringEntity(jsonObject.toString(), ContentType.APPLICATION_JSON));
CloseableHttpResponse response = httpClient.execute(post);
System.out.println(response.getStatusLine());
String result = EntityUtils.toString(response.getEntity(), ContentType.getOrDefault(response.getEntity()).getCharset());
System.out.println("reuslt=" + result);