Java中,Evernote的:撤销对Evernote的应用程序访问 [英] Java, Evernote : Revoke access for app on Evernote

查看:314
本文介绍了Java中,Evernote的:撤销对Evernote的应用程序访问的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的工作,其中有通过Evernote的创建一个应用程序集成到它的Evernote服务的Java项目。目前,一切工作正常,除了访问撤销。

I am working on a Java project which has Evernote services integrated into it through an app created on Evernote. Currently, everything is working fine except for access-revocation.

在谁已经授权的应用程序,在某些时候决定不给这个应用程式的任何访问权限的用户,我想也取消授权从用户的Evernote帐户的应用程序。

When an user who has already authorized the app, at some point decides not to give this app any access, I would like to also de-authorize the app from the users evernote account.

对于这一点,我在寻找一些样品,但来到两手空空。其中一个链接,我发现是,它被要求调用该方法与UserStore。我有访问令牌,但遗憾的是我只能用NoteStoreClient工作,而不是UserStore。

For this, I am searching for some sample, but came empty handed. One link I found was this, where it was required to call that method with UserStore. I have the access-token, but unfortunately I am only working with NoteStoreClient, rather than UserStore.

下面是撤销code我有这么远。

Here is the revocation code I have so far.

 Person person = this.personService.getCurrentlyAuthenticatedUser();

        if (!(person == null)) {
            if (person.isEvernoteConsumed()) {
                try {
                    this.evernoteDAO.deleteEvernoteForUser(person.getId());

                    Evernote evernote = getUsersEvernote(person.getId());
                    EvernoteAuth evernoteAuth = new EvernoteAuth(EVERNOTE_SERVICE, evernote.getAccessToken());
                    NoteStoreClient noteStoreClient = new ClientFactory(evernoteAuth).createNoteStoreClient();

                }catch (Exception e){
                    e.printStackTrace();
                }
            }
        }

没什么特别的在code,我知道了。如果任何人有距离的Evernote撤销任何想法,请让我知道。谢谢你。

Nothing fancy in that code, I know. If anyone has any idea of revocation from Evernote, kindly let me know. Thank you.

推荐答案

您是在正确的轨道上,的这UserStore方法会让您撤销OAuth的会话。就像你说的,你必须使用userstore客户端相反,你应该能够创造同样的方式为你做了notestore客户端:

You're on the right track, that UserStore method will let you revoke your OAuth session. Like you said, you have to use the userstore client instead, you should be able to create it the same way as you did the notestore client:

UserStoreClient userStoreClient =
  new ClientFactory(evernoteAuth).createUserStoreClient();
userStoreClient.revokeLongSession(evernoteAuth);

这篇关于Java中,Evernote的:撤销对Evernote的应用程序访问的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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