使用Codenameone的Oauth2类获取Dropbox Core API的OAuth2访问令牌 [英] Obtain OAuth2 Access Token for Dropbox Core API with Codenameone's Oauth2 Class

查看:95
本文介绍了使用Codenameone的Oauth2类获取Dropbox Core API的OAuth2访问令牌的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用codenameone的Oauth2类来获取Dropbox的Core API的访问令牌。我正在使用的代码如下:

I'm trying to use codenameone's Oauth2 Class to obtain an access token for Dropbox's Core API. The code I'm using is as follows:

Oauth2 auth = new Oauth2("https://www.dropbox.com/1/oauth2/authorize", "<APP KEY>", "https://www.google.com", "");
    Oauth2.setBackToParent(true);
    auth.showAuthentication(new ActionListener(){
        public void actionPerformed(ActionEvent evt) {
            //get authentication token
            System.out.println(evt.getSource());
        }
    });

在模拟器中运行应用程序时,会看到一个包含日志的Web组件进入OAuth2身份验证页面(如预期),但是当我完成登录过程时,该应用程序不会返回到父视图,并且不会触发我的操作侦听器。

When I run my app in the simulator, I'm presented with a web component that contains the log-in page for the OAuth2 authentication (like it's supposed to) but when I complete the sign-in process, The app does not return to the parent view and my action listener is not triggered.

该过程实际上正在运行,因为我收到一条消息,指示我的应用已添加到我的保管箱帐户,但是我的应用无法检索令牌,因为未触发我的操作侦听器。

The process is actually working because I'm getting a message that indicates that my app has been added to my dropbox account, however my app is not able to retrieve the token because my action listener isn't being triggered.

我在Internet上到处都在寻找解决此问题的方法,但找不到任何东西。我发现有另一篇关于SO的文章在问同样的问题,但似乎也没有得到可接受的答案。似乎codenameone提供的关于Oauth类的唯一好的文档是codenameone API Doc,它没有提供很好的示例说明如何使用它们的类。

I've looked everywhere on the internet for a solution to this problem and can't find anything. I found one other article on SO that was asking the same question but wasn't seeming to get an acceptable answer as well. It seems that the only good documentation for the Oauth Class provided by codenameone is the codenameone API Doc and it doesn't provide very good examples for how to use their classes.

谢谢!

推荐答案

您可以使用Dropbox cn1lib- http://www.codenameone.com/ Blog / drop-it-introducing-dropbox-integration

You can use the Dropbox cn1lib - http://www.codenameone.com/blog/drop-it-introducing-dropbox-integration

这篇关于使用Codenameone的Oauth2类获取Dropbox Core API的OAuth2访问令牌的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆