如何在适用于Android的DropboxAPI v2中进行身份验证? [英] How do I authenticate in DropboxAPI v2 for Android?

查看:96
本文介绍了如何在适用于Android的DropboxAPI v2中进行身份验证?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚开始,并且正在关注本教程

I've just started out and I'm following this tutorial

https://www.dropbox.com/developers/documentation/java#tutorial

但是没有登录.没什么要求您输入用户名,密码.这意味着我实际上无法获得每个带有共享到Dropbox"选项的应用程序所具有的GUI.

But there's no login. Nothing asks you for a username, password. That means I can't actually get a GUI that every app with "Share to Dropbox" option has.

我坚持使用一个帐户吗?我是否必须找到一种方法来获得一个人的ACCESS_TOKEN,或者那里有一个更优雅的GUI解决方案(例如Google Drive及其意图者)?

Am I stuck with one account? Do I have to find a way to get a person's ACCESS_TOKEN or is there a more elegant GUI solution out there(like with Google Drive and their intentsenders)?

推荐答案

要在Android中使用Dropbox API v2,您应使用示例Android应用,其中包含SDK.您应该以此为例,说明如何通过OAuth 2实现应用授权流程.这需要用户使用Dropbox授权您的应用,并在必要时登录Dropbox.之后,您的应用可以为该用户存储并重新使用生成的访问令牌,如

To use the Dropbox API v2 in Android, you should use the API v2 Java SDK. There's an example Android app that uses it included with the SDK. You should refer to that as an example of how to implement the app authorization flow, which is accomplished via OAuth 2. That requires the user to authorize your app with Dropbox, by signing in to Dropbox if necessary. After that, your app can store and re-use the resulting access token for that user, as the example does here.

以这种方式实施允许任何用户将其Dropbox帐户连接到您的应用程序.如果需要,您还可以为每个应用实例处理多个帐户.

Implementing it that way allows any user to connect their Dropbox account to your app. You can also handle multiple accounts per instance of your app if you want.

这篇关于如何在适用于Android的DropboxAPI v2中进行身份验证?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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