【问题标题】:i can't use oauth 2.0 to connect with my server using android我无法使用 oauth 2.0 与我的服务器使用 android 连接
【发布时间】:2020-08-09 20:05:05
【问题描述】:

我是 android 新手,我需要使用 oauth 2.0 与服务器建立连接clientSecret 和我需要的范围是正确获取令牌 我希望我的问题很清楚
谢谢
这就是我所做的

AccountManager am = AccountManager.get(Authentification.this);
            Bundle options = new Bundle();
            options.putSerializable("numero", numero);
            
            am.getAuthToken(
                    null,
                    "whrite",
                    options,
                    this,
                    new OnTokenAcquired(),
                    null);

private class OnTokenAcquired implements AccountManagerCallback<Bundle> {
    @Override
    public void run(AccountManagerFuture<Bundle> result) {
        // Get the result of the operation from the AccountManagerFuture.
        try{
            Bundle bundle = result.getResult();

            // The token is a named value in the bundle. The name of the value
            // is stored in the constant AccountManager.KEY_AUTHTOKEN.
            String token = bundle.getString(AccountManager.KEY_AUTHTOKEN);
    System.out.println("================>>>>"+token);

        }catch(Exception e){

        }

    }
}

【问题讨论】:

    标签: android oauth-2.0


    【解决方案1】:

    我将从 AppAuth 代码示例开始。我的blog post 有关于如何运行它的分步说明。

    一旦它开始工作,重新配置它以指向您自己的授权服务器。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-12-27
      • 1970-01-01
      • 2023-04-05
      • 1970-01-01
      相关资源
      最近更新 更多