小编Aus*_*tin的帖子

无法使用谷歌将用户登录到Dropbox

我正在构建一个允许与Dropbox交互的应用程序.我已成功通过身份验证,Dropbox正在使用默认登录页面返回密钥和模板.但是,当我尝试使用Dropbox for Google选项进行身份验证时,Dropbox会返回用户密钥,但是它不会返回模板ID,而是会返回太多的模板错误.

任何帮助,将不胜感激.

这是我的代码

    public void authUrl(HttpServletRequest request)
{
    DbxWebAuth webAuth = new DbxWebAuth(requestConfig, appInfo);
    HttpSession session = request.getSession(true);
    String sessionKey = "dropbox-auth-csrf-token";
    DbxSessionStore csrfTokenStore = new DbxStandardSessionStore(session, sessionKey);

    DbxWebAuth.Request authRequest = DbxWebAuth.newRequestBuilder()
            .withRedirectUri(redirectUri, csrfTokenStore)
            .build();
    String authorizeUrl = webAuth.authorize(authRequest);
    url =authorizeUrl;
}
public String getTemplate()
{
    HttpClient httpclient = new DefaultHttpClient();
    HttpPost post = new HttpPost("https://api.dropboxapi.com/2/file_properties/templates/add_for_user");
    post.addHeader("Authorization","Bearer "+code);
    post.addHeader("Content-Type", "application/json");
    try {
        HttpEntity entity = new StringEntity(json);
        post.setEntity(entity);
    } catch (UnsupportedEncodingException e) {
        // TODO Auto-generated catch block …
Run Code Online (Sandbox Code Playgroud)

java dropbox dropbox-api google-oauth

9
推荐指数
0
解决办法
193
查看次数

标签 统计

dropbox ×1

dropbox-api ×1

google-oauth ×1

java ×1