|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.dropbox.client2.session.AbstractSession
com.dropbox.client2.session.WebAuthSession
public class WebAuthSession
Keeps track of a logged in user contains configuration options for the
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.
Nested Class Summary | |
---|---|
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. |
Nested classes/interfaces inherited from interface com.dropbox.client2.session.Session |
---|
Session.AccessType, Session.ProxyInfo |
Constructor Summary | |
---|---|
WebAuthSession(AppKeyPair appKeyPair,
Session.AccessType type)
Creates a new web auth session with the given app key pair and access type. |
|
WebAuthSession(AppKeyPair appKeyPair,
Session.AccessType type,
AccessTokenPair accessTokenPair)
Creates a new web auth session with the given app key pair and access type. |
Method Summary | |
---|---|
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. |
Methods inherited from class com.dropbox.client2.session.AbstractSession |
---|
getAccessTokenPair, getAccessType, getAPIServer, getAppKeyPair, getContentServer, getHttpClient, getLocale, getProxyInfo, getWebServer, isLinked, setAccessTokenPair, setRequestTimeout, sign, unlink |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public WebAuthSession(AppKeyPair appKeyPair, Session.AccessType type)
public WebAuthSession(AppKeyPair appKeyPair, Session.AccessType type, AccessTokenPair accessTokenPair)
Method Detail |
---|
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.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |