소스 검색

docs: document Companions Auth and Token mechanism (#1540)

Ifedapo .A. Olarewaju 6 년 전
부모
커밋
926b3ee4fa
1개의 변경된 파일19개의 추가작업 그리고 0개의 파일을 삭제
  1. 19 0
      website/src/docs/companion.md

+ 19 - 0
website/src/docs/companion.md

@@ -333,3 +333,22 @@ This would get the Companion instance running on `http://localhost:3020`. It use
 ## Live example
 
 An example server is running at https://companion.uppy.io, which is deployed with [Kubernetes](https://github.com/transloadit/uppy/blob/master/packages/%40uppy/companion/KUBERNETES.md)
+
+
+## How the Authentication and Token mechanism works
+
+This section describes how Authentication works between Companion and Providers. While this behaviour is the same for all Providers (Dropbox, Instagram, Google Drive), we are going to be referring to Dropbox in place of any Provider throughout this section.
+
+The following steps describe the actions that take place when a user Authenticates and Uploads from Dropbox through Companion:
+
+- The visitor to a website with Uppy clicks "Connect to Dropbox".
+- Uppy sends a request to Companion, which in turn sends an OAuth request to Dropbox (Requires that OAuth credentials from Dropbox have been added to Companion).
+- Dropbox asks the visitor to log in, and whether the Website should be allowed to access your files
+- If the visitor agrees, Companion will receive a token from Dropbox, with which we can temporarily download files.
+- Companion encrypts the token with a secret key and sends the encrypted token to Uppy (client)
+- Every time the visitor clicks on a folder in Uppy, it asks Companion for the new list of files, with this question, the token (still encrypted by Companion) is sent along.
+- Companion decrypts the token, requests the list of files from Dropbox and sends it to Uppy.
+- When a file is selected for upload, Companion receives the token again according to this procedure, decrypts it again, and thereby downloads the file from Dropbox.
+- As the bytes arrive, Companion uploads the bytes to the final destination (depending on the configuration: Apache, a Tus server, S3 bucket, etc).
+- Companion reports progress to Uppy, as if it were a local upload.
+- Completed!