【问题标题】:How to provide credentials for Google Apps user creation using JAVA API如何为使用 JAVA API 创建 Google Apps 用户提供凭据
【发布时间】:2015-06-24 13:28:28
【问题描述】:

从 Google 文档中,我了解到不再使用电子邮件配额。我同意,但问题是如何为在 Google Apps 中创建用户提供凭据。目前我正在这样做:

GoogleCredential credential = new GoogleCredential.Builder()
                  .setTransport(transport)
                  .setJsonFactory(jsonFactory)
                  .setClientSecrets(adminid, adminpwd)
                  .build();

但我收到 401 Unauthorized。

【问题讨论】:

    标签: google-oauth google-admin-sdk


    【解决方案1】:

    您的访问令牌在哪里?试试

    credential.refreshToken();
    accessToken = credential.getAccessToken();
    credential.setAccessToken(accessToken);
    

    您可能还想检索refresh token。使用令牌构建您的凭据可能更简洁。请参阅文档herehere

    【讨论】:

    • 感谢您的回答。不幸的是,我没有令牌,因为我只想管理(创建用户帐户、删除、更新等)谷歌应用程序中的用户。我没有创建任何程序,因此我没有凭据设置。我在该主题下找到了合适的内容:Google App Engine 身份,但该信息只会带来更多问题,而不是提供答案:-我应该将凭据放在哪里(用户名、密码)-为什么运行时库未添加到 google 客户端库(即 com/google/appengine/api/appidentity/AppIdentityServiceFactory)
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-12-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-08-30
    相关资源
    最近更新 更多