Obtain OAuth2 Access Token for Dropbox Core API with Codenameone's Oauth2 Class

我与影子孤独终老i 提交于 2019-12-02 14:39:14

问题


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

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.

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.

If anyone could help that would be greate

Thanks!


回答1:


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



来源:https://stackoverflow.com/questions/25734460/obtain-oauth2-access-token-for-dropbox-core-api-with-codenameones-oauth2-class

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!