🚀 DAY 2 OF LAUNCH WEEK: Unify Your Security Stack with Socket Basics.Learn more →
Socket
Book a DemoInstallSign in
Socket

@openmobilehub/storage-dropbox

Package Overview
Dependencies
Maintainers
0
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@openmobilehub/storage-dropbox

Dropbox integration for React Native OMH Storage. Offers a lightweight bridge to integrate your app with Dropbox's cloud storage using the official SDK and API.

latest
Source
npmnpm
Version
1.0.0-alpha.0
Version published
Weekly downloads
18
1700%
Maintainers
0
Weekly downloads
 
Created
Source


React Native OMH Storage - Dropbox

NPM downloads NPM version License

Chat on Discord Follow on Twitter

Prerequisites

Before starting the integration, make sure the following packages are installed and configured:

  • @openmobilehub/storage-core
  • react-native-file-access
  • @react-native-async-storage/async-storage
  • react-native-app-auth - Configuration
  • @openmobilehub/auth-core - Configuration
  • @openmobilehub/auth-dropbox - Configuration

Installation

npm add @openmobilehub/storage-dropbox

Console App

To access Dropbox APIs, follow these steps to obtain the Client App Key and Client App Secret:

  • Create a new app in Dropbox Console.
  • Specify <YOUR_APPLICATION_ID>://oauth as your redirect URL for your app.
  • Enable the account_info.read, files.metadata.read, files.content.write, files.content.read, sharing.write and sharing.read permission for your app.

Secrets

To securely configure the Dropbox storage provider, add the following entry to your project's local.properties file:

DROPBOX_CLIENT_ID=<YOUR_DROPBOX_APP_KEY>

Usage

Initializing

To interact with the Dropbox storage provider, start by initializing the OMH Auth Client. Once the authentication client is set up, you can then initialize the OMH Storage Client.

import DropboxAuthClient from '@openmobilehub/auth-dropbox';
import { DropboxStorageClient } from '@openmobilehub/storage-dropbox';

const scopes = [
  'account_info.read',
  'files.metadata.read',
  'files.content.write',
  'files.content.read',
  'sharing.write',
  'sharing.read',
];

await DropboxAuth.initialize({
  android: { scopes },
  ios: {
    scopes,
    clientId: '<YOUR_DROPBOX_APP_KEY>',
    clientSecret: '<YOUR_DROPBOX_APP_SECRET>',
    redirectUrl: '<YOUR_REDIRECT_URL>',
  },
});

const dropboxStorageClient = new DropboxStorageClient(DropboxAuth);

Other methods

Interacting with the Dropbox storage provider follows the same pattern as other storage providers since they all implement the IStorageClient interface. This uniformity ensures consistent functionality across different storage providers, so you won’t need to learn new methods regardless of the storage provider you choose! For a comprehensive list of available methods, refer to the Getting Started guide.

:::warning[CAVEATS]

When updating a file, if the new file has a different name than the updated file, two additional versions might sometimes appear in the system. One version comes from updating the content of the file, and the other comes from updating the file name.

The createPermission method returns null when a permission is successfully created.

The updatePermission method returns null when a permission is successfully updated.

The getWebUrl method requires the folder to be a shared folder to return a web URL.

The getFilePermissions method requires the folder to be a shared folder to retrieve any permissions, including owner permission.

:::

License

Keywords

react-native

FAQs

Package last updated on 05 Sep 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts