Getting error 401 while fetching Zoom Access Token

Hello Zoom Team,

I am using Android Meeting Sdk with SDK app with version 5.7.1.1267 and creating Json Web Token in backend which is required to fetch Zoom Access Token using jwt.io library and following code to generate token :

String secret = SDK_SECRET;
Key hmacKey = new SecretKeySpec(Base64.getDecoder().decode(secret),
SignatureAlgorithm.HS256.getJcaName());
long nowMillis = System.currentTimeMillis();
Date now = new Date(nowMillis);
long expMillis = nowMillis + 86400;
Date exp = new Date(expMillis);
String jwtToken = Jwts.builder()
.claim(“name”, “Jane Doe”)
.claim(“email”, “jane@example.com”)
.setSubject(“jane”)
.setId(UUID.randomUUID().toString())
.setIssuedAt(now)
.setExpiration(exp)
.signWith(hmacKey);
.compact();

and using this method to hit the API :

try {
String zoomUrl = “https://api.zoom.us/v2/users/me/token”;
URL url = new URL(zoomUrl);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setRequestMethod(“POST”);
connection.setRequestProperty (“Authorization”, jwtToken);
connection.setDoOutput(true);
int responseCode = connection.getResponseCode();
String responseFromZoom = “”;
String zoomResult = “”;
InputStream is = connection.getInputStream();
BufferedReader responseReader = new BufferedReader(new InputStreamReader(is));
while ((responseFromZoom = responseReader.readLine()) != null) {
zoomResult += responseFromZoom;
}
responseReader.close();
} catch (Exception exception) {
exception.printStackTrace();
}

I am sending https://api.zoom.us/v2/users/me/token to get Zoom Access Token, but I am not getting token, I am getting error 401 in response from zoom.

Please help me out from this situation and suggest changes to be done to correct this.

Thank you
Megha

Hi @Megha1,

As previously mentioned, this is an issue with the REST API so you should continue using the #api-and-webhooks category. I see you have already created another topic for this in that category. Please do not post the same question in multiple topics, as it can make the forum more difficult to navigate for other users. For more information, see the dev forum FAQ.

Thanks!