DbxWebAuth
instead with a DbxWebAuth.Request
configured with no
redirect URI (see DbxWebAuth.Request.Builder.withNoRedirect()
).@Deprecated public class DbxWebAuthNoRedirect extends Object
DbxWebAuth
class instead with a DbxWebAuth.Request
configured to use a redirect
URI.
This class is deprecated and should no longer be used. Instead use DbxWebAuth
and DbxWebAuth.Request.Builder.withNoRedirect()
to start an OAuth web-based authorization
flow without redirects.
Eventually yields an access token that can be used with DbxClientV2
to make
Dropbox API calls. You typically only need to do this for a user when they first use your
application. Once you have an access token for that user, it remains valid for years.
Example:
String userLocale = ...DbxRequestConfig
requestConfig = new DbxRequestConfig("text-edit/0.1", userLocale);DbxAppInfo
appInfo = DbxAppInfo.Reader.readFromFile("api.app"); DbxWebAuthNoRedirect webAuth = new DbxWebAuthNoRedirect(requestConfig, appInfo); String authorizeUrl = webAuth.start(); System.out.println("1. Go to " + authorizeUrl); System.out.println("2. Click \"Allow\" (you might have to log in first)."); System.out.println("3. Copy the authorization code."); System.out.print("Enter the authorization code here: "); String code = new BufferedReader(new InputStreamReader(System.in)).readLine(); if (code == null) return; code = code.trim();DbxAuthFinish
authFinish = webAuth.finish(code);DbxClientV2
client = new DbxClientV2(requestConfig, authFinish.accessToken);
Constructor and Description |
---|
DbxWebAuthNoRedirect(DbxRequestConfig requestConfig,
DbxAppInfo appInfo)
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
DbxAuthFinish |
finish(String code)
Deprecated.
Call this after the user has visited the authorizaton URL and copy/pasted the authorization
code that Dropbox gave them.
|
String |
start()
Deprecated.
Start authorization.
|
public DbxWebAuthNoRedirect(DbxRequestConfig requestConfig, DbxAppInfo appInfo)
appInfo
- Your application's Dropbox API information (the app key and secret).public String start()
If they choose to grant access, they will be shown an "authorization code", which they
need to copy/paste back into your app, at which point you can call finish(java.lang.String)
to get an
access token.
public DbxAuthFinish finish(String code) throws DbxException
code
- The authorization code shown to the user when they clicked "Allow" on the authorization
page on the Dropbox website.DbxException