Class Auth


  • public class Auth
    extends java.lang.Object
    Helper class for integrating with AuthActivity
    • Constructor Summary

      Constructors 
      Constructor Description
      Auth()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static DbxCredential getDbxCredential()  
      static java.lang.String getOAuth2Token()  
      static java.lang.String getScope()
      Get the scope authorized in this OAuth flow.
      static java.lang.String getUid()  
      static void startOAuth2Authentication​(android.content.Context context, java.lang.String appKey)  
      static void startOAuth2Authentication​(android.content.Context context, java.lang.String appKey, java.lang.String desiredUid, java.lang.String[] alreadyAuthedUids, java.lang.String sessionId)  
      static void startOAuth2Authentication​(android.content.Context context, java.lang.String appKey, java.lang.String desiredUid, java.lang.String[] alreadyAuthedUids, java.lang.String sessionId, java.lang.String webHost)
      Starts the Dropbox authentication process by launching an external app (either the Dropbox app if available or a web browser) where the user will log in and allow your app access.
      static void startOAuth2PKCE​(android.content.Context context, java.lang.String appKey, DbxRequestConfig requestConfig)  
      static void startOAuth2PKCE​(android.content.Context context, java.lang.String appKey, DbxRequestConfig requestConfig, DbxHost host)
      Starts the Dropbox OAuth process by launching the Dropbox official app (AKA DAuth) or web browser if dropbox official app is not available.
      static void startOAuth2PKCE​(android.content.Context context, java.lang.String appKey, DbxRequestConfig requestConfig, DbxHost host, java.util.Collection<java.lang.String> scope)  
      static void startOAuth2PKCE​(android.content.Context context, java.lang.String appKey, DbxRequestConfig requestConfig, DbxHost host, java.util.Collection<java.lang.String> scope, IncludeGrantedScopes includeGrantedScopes)
      Starts the Dropbox OAuth process by launching the Dropbox official app (AKA DAuth) or web browser if dropbox official app is not available.
      static void startOAuth2PKCE​(android.content.Context context, java.lang.String appKey, DbxRequestConfig requestConfig, java.util.Collection<java.lang.String> scope)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Auth

        public Auth()
    • Method Detail

      • startOAuth2PKCE

        public static void startOAuth2PKCE​(android.content.Context context,
                                           java.lang.String appKey,
                                           DbxRequestConfig requestConfig,
                                           java.util.Collection<java.lang.String> scope)
        Parameters:
        scope - A list of scope strings. Each scope correspond to a group of API endpoints. To call one API endpoint you have to obtains the scope first otherwise you will get HTTP 401.
        See Also:
        startOAuth2PKCE(Context, String, DbxRequestConfig, DbxHost)
      • startOAuth2PKCE

        public static void startOAuth2PKCE​(android.content.Context context,
                                           java.lang.String appKey,
                                           DbxRequestConfig requestConfig,
                                           DbxHost host)
        Starts the Dropbox OAuth process by launching the Dropbox official app (AKA DAuth) or web browser if dropbox official app is not available. In browser flow, normally user needs to sign in.
        Parameters:
        context - the Context to use to launch the * Dropbox authentication activity. This will typically be an * Activity and the user will be taken back to that * activity after authentication is complete (i.e., your activity * will receive an onResume()).
        appKey - the app's key.
        requestConfig - Default attributes to use for each request
        host - Dropbox hosts to send requests to (used for mocking and testing)
      • startOAuth2PKCE

        public static void startOAuth2PKCE​(android.content.Context context,
                                           java.lang.String appKey,
                                           DbxRequestConfig requestConfig,
                                           DbxHost host,
                                           java.util.Collection<java.lang.String> scope)
      • startOAuth2PKCE

        public static void startOAuth2PKCE​(android.content.Context context,
                                           java.lang.String appKey,
                                           DbxRequestConfig requestConfig,
                                           DbxHost host,
                                           java.util.Collection<java.lang.String> scope,
                                           IncludeGrantedScopes includeGrantedScopes)
        Starts the Dropbox OAuth process by launching the Dropbox official app (AKA DAuth) or web browser if dropbox official app is not available. In browser flow, normally user needs to sign in.
        Parameters:
        context - the Context to use to launch the * Dropbox authentication activity. This will typically be an * Activity and the user will be taken back to that * activity after authentication is complete (i.e., your activity * will receive an onResume()).
        appKey - the app's key.
        requestConfig - Default attributes to use for each request
        host - Dropbox hosts to send requests to (used for mocking and testing)
        scope - A list of scope strings. Each scope correspond to a group of API endpoints. To call one API endpoint you have to obtains the scope first otherwise you will get HTTP 401.
        includeGrantedScopes - If this is set, result will contain both new scopes and all previously granted scopes. It enables incrementally requesting scopes.
      • startOAuth2Authentication

        public static void startOAuth2Authentication​(android.content.Context context,
                                                     java.lang.String appKey,
                                                     java.lang.String desiredUid,
                                                     java.lang.String[] alreadyAuthedUids,
                                                     java.lang.String sessionId,
                                                     java.lang.String webHost)
        Starts the Dropbox authentication process by launching an external app (either the Dropbox app if available or a web browser) where the user will log in and allow your app access.

        This variant should be used when authentication is being done due to an OpenWith request through action "com.dropbox.android.intent.action.DBXC_EDIT" and "com.dropbox.android.intent.action.DBXC_VIEW". You won't need to use this unless you are a partner who registered your app with openwith feature in our official Dropbox app.

        Parameters:
        context - the Context to use to launch the Dropbox authentication activity. This will typically be an Activity and the user will be taken back to that activity after authentication is complete (i.e., your activity will receive an onResume()).
        appKey - the app's key.
        desiredUid - Encourage user to authenticate account defined by this uid. (note that user still can authenticate other accounts). May be null if no uid desired.
        alreadyAuthedUids - Array of any other uids currently authenticated with this app. May be null if no uids previously authenticated. Authentication screen will encourage user to not authorize these user accounts. (note that user may still authorize the accounts).
        sessionId - The SESSION_ID Extra on an OpenWith intent. null if dAuth is being launched outside of OpenWith flow
        webHost - Server host used for oauth
        Throws:
        java.lang.IllegalStateException - if you have not correctly set up the AuthActivity in your manifest, meaning that the Dropbox app will not be able to redirect back to your app after auth.
      • getOAuth2Token

        public static java.lang.String getOAuth2Token()
      • getUid

        public static java.lang.String getUid()
      • getDbxCredential

        public static DbxCredential getDbxCredential()
        Returns:
        The result after
      • getScope

        public static java.lang.String getScope()
        Get the scope authorized in this OAuth flow.
        Returns:
        A list of scope returned by Dropbox server. Each scope correspond to a group of API endpoints. To call one API endpoint you have to obtains the scope first otherwise you will get HTTP 401.