【问题标题】:how to integrate with Zoom app using android?如何使用 android 与 Zoom 应用程序集成?
【发布时间】:2021-10-26 12:54:14
【问题描述】:

我是缩放集成的新手。 我想要用户登录并在他们的帐户中创建会议。我已经使用 loginWithZoom 方法完成了登录用户部分,但现在想为所需的身份验证令牌创建会议。

用户在没有 OAuth 的情况下登录缩放时如何获取令牌?

我已经找到但没有得到太多的想法。我尝试使用它可以使用的 JWT 令牌 https://api.zoom.us/v2/users/me/meetings api。我给了Authorization 令牌和content-type in headers。它为我提供了该特定用户的所有会议。但是为不同的用户获得不同的authorization token 的问题。我不知道有没有可能。

如果有人知道,请提出建议

我用于登录的代码:

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();
            }
        }

提前致谢。

【问题讨论】:

  • 你能添加你已经做过的代码吗?另外,只是一个建议,你检查过官方的 Zoom SDK 吗?这可能会使工作更轻松
  • @gtxtreme 我添加了用于登录的代码。我在使用 OAuth 的创建会议中检查了 zoom sdk 文档。

标签: java android access-token zoom-sdk


【解决方案1】:

我尝试过使用它的 JWT 令牌 https://api.zoom.us/v2/users/me/meetings api。我给了Authorization 令牌和content-typeheaders。它给了我所有的会议 特定用户。但是获得不同authorization token 的问题 不同的用户。我不知道有没有可能。

假设这些用户不是同一个 Zoom 帐户的一部分,那么不,从 2021 年 8 月 28 日起这是不可能的。 JWT-based authentication is only for Zoom integration in internal applications/services:

注意: JWT 只能用于内部应用程序和流程。为第三方使用而创建的所有应用都必须使用我们的 OAuth 应用类型。

在此上下文中,“内部”是指“仅用于单个 Zoom 帐户”。请注意,一个帐户下可以有多个用户(例如,XYZ 公司的所有员工都是 XYZ 的 Zoom 帐户的一部分)。换句话说,您可以使用为 XYZ Zoom 帐户签发的 JWT 访问 XYZ Zoom 帐户下所有用户的信息,但如果您需要用户的数据XYZ Zoom 帐户的一部分,那么您还需要他们的 Zoom 帐户的 API 密钥和 API 机密,以生成可用于检索其数据的 JWT。

如果您正在构建一个集成/服务并希望向公众提供,那么您需要使用OAuth

可以通过一个帐户安装和管理此应用 帐户管理员(帐户级应用程序)或由用户单独 (用户管理的应用程序)。

【讨论】:

  • 您知道在 OAuth 中为 Android 应用设置哪个重定向 URL 吗?我想我们不能在那里设置https url。
  • 我自己没有使用过OAuth认证。基于 JWT 的身份验证满足了我的需求。但是如果你不能在这部分使用 HTTPS,那将是一个巨大的安全漏洞。您是否在此处阅读了有关重定向 URL 的部分:marketplace.zoom.us/docs/guides/auth/…
  • 好的。有没有办法使用android SDK创建会议?
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2013-01-13
  • 2013-08-18
  • 2013-12-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多