public class WebAuthSession extends AbstractSession
DropboxAPI. This type of Session uses the web OAuth flow
to authenticate users:
getAuthInfo() or
getAuthInfo(String).retrieveWebAccessToken(RequestTokenPair) with
the previously-saved request token + secret. You have a limited amount
of time to make this call or the request token will expire.| Modifier and Type | Class and Description |
|---|---|
static class |
WebAuthSession.WebAuthInfo
Contains the info needed to send the user to the Dropbox web auth page
and later retrieve an access token + secret.
|
Session.AccessType, Session.ProxyInfo| Constructor and Description |
|---|
WebAuthSession(AppKeyPair appKeyPair)
Creates a new web auth session with the given app key pair.
|
WebAuthSession(AppKeyPair appKeyPair,
AccessTokenPair accessTokenPair)
Creates a new web auth session with the given app key pair.
|
WebAuthSession(AppKeyPair appKeyPair,
Session.AccessType type)
Deprecated.
You don't need to specify the access type anymore. Use
WebAuthSession(AppKeyPair). |
WebAuthSession(AppKeyPair appKeyPair,
Session.AccessType type,
AccessTokenPair accessTokenPair)
Deprecated.
You don't need to specify the access type anymore. Use
WebAuthSession(AppKeyPair, AccessTokenPair). |
| Modifier and Type | Method and Description |
|---|---|
WebAuthSession.WebAuthInfo |
getAuthInfo()
Starts an authentication request with Dropbox servers and gets all the
info you need to start authenticating a user.
|
WebAuthSession.WebAuthInfo |
getAuthInfo(java.lang.String callbackUrl)
Starts an authentication request with Dropbox servers and gets all the
info you need to start authenticating a user.
|
java.lang.String |
retrieveWebAccessToken(RequestTokenPair requestTokenPair)
When called after the user is done authenticating, sets the user's
access token + secret on this session.
|
getAccessTokenPair, getAccessType, getAPIServer, getAppKeyPair, getContentServer, getHttpClient, getLocale, getOAuth2AccessToken, getProxyInfo, getWebServer, isLinked, setAccessTokenPair, setOAuth2AccessToken, setRequestTimeout, sign, unlinkpublic WebAuthSession(AppKeyPair appKeyPair, Session.AccessType type)
WebAuthSession(AppKeyPair).public WebAuthSession(AppKeyPair appKeyPair, Session.AccessType type, AccessTokenPair accessTokenPair)
WebAuthSession(AppKeyPair, AccessTokenPair).public WebAuthSession(AppKeyPair appKeyPair)
public WebAuthSession(AppKeyPair appKeyPair, AccessTokenPair accessTokenPair)
public WebAuthSession.WebAuthInfo getAuthInfo() throws DropboxException
getAuthInfo(String).WebAuthSession.WebAuthInfo, from which you can obtain the URL to
redirect the user to and a request token + secret to log the
user in later.DropboxServerException - if the server responds with an error
code. See the constants in DropboxServerException for
the meaning of each error code. The most common error codes you
can expect from this call are 500, 502, and 503 (all related to
internal Dropbox server issues).DropboxIOException - if any network-related error occurs.DropboxParseException - if a malformed or unknown response was
received from the server.DropboxException - for any other unknown errors. This is also a
superclass of all other Dropbox exceptions, so you may want to
only catch this exception which signals that some kind of error
occurred.public WebAuthSession.WebAuthInfo getAuthInfo(java.lang.String callbackUrl) throws DropboxException
callbackUrl - the URL to which Dropbox will redirect the user after
he/she has authenticated on the Dropbox site.WebAuthSession.WebAuthInfo, from which you can obtain the URL to
redirect the user to and a request token + secret to log the
user in later.DropboxServerException - if the server responds with an error
code. See the constants in DropboxServerException for
the meaning of each error code. The most common error codes you
can expect from this call are 500, 502, and 503 (all for
internal Dropbox server issues).DropboxIOException - if any network-related error occurs.DropboxParseException - if a malformed or unknown response was
received from the server.DropboxException - for any other unknown errors. This is also a
superclass of all other Dropbox exceptions, so you may want to
only catch this exception which signals that some kind of error
occurred.public java.lang.String retrieveWebAccessToken(RequestTokenPair requestTokenPair) throws DropboxException
requestTokenPair - the request token pair from the WebAuthSession.WebAuthInfo
returned from getAuthInfo().DropboxServerException - if the server responds with an error
code. See the constants in DropboxServerException for
the meaning of each error code. The most common error codes you
can expect from this call are 401 (bad request token), 403 (bad
app key pair), 500, 502, and 503 (all for internal Dropbox
server issues).DropboxIOException - if any network-related error occurs.DropboxParseException - if a malformed or unknown response was
received from the server.DropboxException - for any other unknown errors. This is also a
superclass of all other Dropbox exceptions, so you may want to
only catch this exception which signals that some kind of error
occurred.