Class DbxPKCEWebAuth


  • public class DbxPKCEWebAuth
    extends java.lang.Object
    This class does the OAuth2 "authorization code" flow with Proof Key for Code Exchange(PKCE). PKCE allows "authorization code" flow without "client_secret". It enables "native application", which is ensafe to hardcode client_secret in code, to use "authorization code". If you application has a server, please use regular DbxWebAuth instead. PKCE is more secure than "token" flow. If authorization code is compromised during transmission, it can't be used to exchange for access token without random generated code_verifier, which is stored inside SDK. DbxPKCEWebAuth and DbxWebAuth has the same interface and slightly different behavior:
    1. The constructor should take DbxAppInfo without app secret.
    2. Two step of OAuth2: authorize(DbxWebAuth.Request) and finishFromRedirect(String, DbxSessionStore, Map), should be called on the same object.
    See Also:
    https://tools.ietf.org/html/rfc7636 and new dropbox oauth guide
    • Constructor Summary

      Constructors 
      Constructor Description
      DbxPKCEWebAuth​(DbxRequestConfig requestConfig, DbxAppInfo appInfo)
      Creates a new instance that will perform the OAuth2 PKCE authorization flow using the given OAuth request configuration.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String authorize​(DbxWebAuth.Request request)
      Starts authorization and returns an "authorization URL" on the Dropbox website that let the user grant your app access to their Dropbox account.
      DbxAuthFinish finishFromCode​(java.lang.String code)
      Call this after the user has visited the authorizaton URL and copy/pasted the authorization code that Dropbox gave them, with the SAME DbxPKCEWebAuth instance that generated the authorization URL.
      DbxAuthFinish finishFromRedirect​(java.lang.String redirectUri, DbxSessionStore sessionStore, java.util.Map<java.lang.String,​java.lang.String[]> params)
      Call this after the user has visited the authorizaton URL and Dropbox has redirected them back to your native app, with the SAME DbxPKCEWebAuth instance that generated the authorization URL.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait