how to integrate with Zoom app using android?

Viewed 870

I'm new with zoom integration. I wants user login and create meeting in their account. I've done login user part using loginWithZoom method but now wants to create meeting for that auth token needed.

How can I get token when user login in zoom without OAuth?

I've found but not getting much idea. I tried with JWT token it works with https://api.zoom.us/v2/users/me/meetings api. I gave Authorization token and content-type in headers. it gives me all meetings of that specific user. but problem to get different authorization token for different users. I don't have idea is it possible or not.

Suggest if anyone knows

enter image description here

Code I've used for Login:

public void initializeSdk(Context context) {
        ZoomSDK sdk = ZoomSDK.getInstance();
        // TODO: Do not use hard-coded values for your key/secret in your app in production!
        ZoomSDKInitParams params = new ZoomSDKInitParams();
        params.appKey = "a...t4.."; // TODO: Retrieve your SDK key and enter it here
        params.appSecret = "y...19"; // TODO: Retrieve your SDK secret and enter it here
        params.domain = "zoom.us";
        params.enableLog = true;
        // TODO: Add functionality to this listener (e.g. logs for debugging)
        ZoomSDKInitializeListener listener = new ZoomSDKInitializeListener() {
            /**
             * @param errorCode {@link us.zoom.sdk.ZoomError#ZOOM_ERROR_SUCCESS} if the SDK has been initialized successfully.
             */
            @Override
            public void onZoomSDKInitializeResult(int errorCode, int internalErrorCode) {
            Log.i("","onZoomSDKInitializeResult Error code"+errorCode);
             Toast.makeText(getApplicationContext()," error code : " + errorCode,Toast.LENGTH_LONG).show();
            }

            @Override
            public void onZoomAuthIdentityExpired() {
                System.out.println(" identity expired..");
            }
        };
        sdk.initialize(context, listener, params);
    }
 findViewById(R.id.login_button).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Toast.makeText(getApplicationContext(), "onclick of login", Toast.LENGTH_LONG).show();
                Log.i(" ","onclick of login : "+ ZoomSDK.getInstance().isLoggedIn());
                if (ZoomSDK.getInstance().isLoggedIn()) {
                   //wants to create meeting
                } else {
                   createLoginDialog();

                }
            }
        });

private void createLoginDialog() {
        new AlertDialog.Builder(this)
                .setView(R.layout.dialog_login)
                .setPositiveButton("Log in", new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialogInterface, int i) {
                        AlertDialog dialog = (AlertDialog) dialogInterface;
                        TextInputEditText emailInput = dialog.findViewById(R.id.email_input);
                        TextInputEditText passwordInput = dialog.findViewById(R.id.pw_input);
                        if (emailInput != null && emailInput.getText() != null && passwordInput != null && passwordInput.getText() != null) {
                            String email = emailInput.getText().toString();
                            String password = passwordInput.getText().toString();
                            if (email.trim().length() > 0 && password.trim().length() > 0) {
                                login(email, password);
                            }
                        }
                        dialog.dismiss();
                    }
                })
                .show();
    }
  public void login(String username, String password) {

        int result = ZoomSDK.getInstance().loginWithZoom(username, password);

        if (result == ZoomApiError.ZOOM_API_ERROR_SUCCESS) {
            // Request executed, listen for result to start meeting
            ZoomSDK.getInstance().addAuthenticationListener(authListener);
        }
    }
 public void onZoomSDKLoginResult(long result) {
            if (result == ZoomAuthenticationError.ZOOM_AUTH_ERROR_SUCCESS) {
                // Once we verify that the request was successful, we may start the meeting
                Toast.makeText(getApplicationContext(), "Login successfully", Toast.LENGTH_SHORT).show();
            } else if(result == ZoomAuthenticationError.ZOOM_AUTH_ERROR_USER_NOT_EXIST || result == ZoomAuthenticationError.ZOOM_AUTH_ERROR_WRONG_PASSWORD){
                Toast.makeText(getApplicationContext(),"Invalid username or password",Toast.LENGTH_LONG).show();
            }
        }

Thanks in advance.

1 Answers

I tried with JWT token it works with https://api.zoom.us/v2/users/me/meetings api. I gave Authorization token and content-type in headers. it gives me all meetings of that specific user. but problem to get different authorization token for different users. I don't have idea is it possible or not.

Assuming these users are not part of the same Zoom account, then no, it is not possible as of 2021-08-28. JWT-based authentication is only for Zoom integration in internal applications/services:

Note: JWT may only be used for internal applications and processes. All apps created for third-party usage must use our OAuth app type.

In this context, "internal" means "only to be used with a single Zoom account." Note that there can be many users under one account (e.g., all employees of Corporation XYZ are part of XYZ's Zoom account). Put differently, you can use a JWT issued for the XYZ Zoom account to access information for all users under the XYZ Zoom account, but if you need data for users that are not part of the XYZ Zoom account, then you need an API Key and API Secret for their Zoom account(s) as well to generate JWTs that you can use to retrieve their data.

If you are building an integration/service that you want to make available to the general public, then you need to use OAuth:

This app can either be installed and managed across an account by account admins (account-level app) or by users individually (user-managed app).

Related