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