It was a misunderstanding of the workflow on my side. All oAuth workflows I had implemented until now had me re-generating tokens when they expired.
I did not understand why I could not re-generate a token once it was expired, now I understand I have to use the expiration token for that.
It makes the token management a little bit harder, as I have to store much more data on my end, and honestly, I am not sure if this is better from a security perspective.
It is the first time I have to store…
app credentials
creation date (so I can calculate expiration)
token
expiration token for renewal
user id
but it is up and running now. It just took me a few more roundtrips to get it up and running.
I’m struggling as well to get access token
After successfully getting the User Authorization Code, I failed to get the Access Token !
My Code:
String uri = “https://zoom.us/oauth/token?grant_type=authorization_code&code=” + zoom_code + “&redirect_uri=” + WEB_PREFIX + ACCOUNT_SERVER_URL + “/access_token.php”;
URL url = new URL(uri);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setRequestProperty(“Content-Type”, “application/json”);
connection.setRequestMethod(“POST”);
String client_id_and_secret = “PaVU8EC8QCGR7CLwcdWDUA:lCtfhplFmbl4yLbl4YLH8opejiy3gWvz”;
byte results = client_id_and_secret.getBytes(UTF_8);
connection.setRequestProperty(“Authorization”, "Basic " + new String(Base64.encode(results, Base64.NO_WRAP)));
resCode = connection.getResponseCode();
I managed to solve the problem.
In your documentation:
" HEADERS: {"Authorization": "Basic {BASE64ENCODED_CLIENT_ID}:{BASE64ENCODED_CLIENT_SECRET}"}"
You mislead us a bit as the true answer is:
" HEADERS: {"Authorization": "Basic BASE64ENCODED(CLIENT_ID:CLIENT_SECRET)"}"