Fix for redirect_uri on RunPod
This commit is contained in:
@@ -38,12 +38,25 @@ pip install -r requirements.txt
|
||||
|
||||
1. Go to the [Dropbox App Console](https://www.dropbox.com/developers/apps) and create a new app.
|
||||
2. Enable `App Folder` access and note your **App Key** and **App Secret**.
|
||||
3. Generate an **Authorization Code** via:
|
||||
3. **For RunPod users**: The authorization URL will be automatically generated with the correct redirect URI when you run `get_refresh_token.py`
|
||||
4. **For local users**: Generate an **Authorization Code** via:
|
||||
```
|
||||
https://www.dropbox.com/oauth2/authorize?client_id=APPKEY&response_type=code&token_access_type=offline
|
||||
https://www.dropbox.com/oauth2/authorize?client_id=APPKEY&response_type=code&token_access_type=offline&redirect_uri=https://localhost
|
||||
```
|
||||
4. Paste these into the **🛠️ Dropbox Setup** node and run it once.
|
||||
5. Then use the **📤 Dropbox AutoUploader** node in your workflow to monitor and upload.
|
||||
5. Paste these into the **🛠️ Dropbox Setup** node and run it once.
|
||||
6. Then use the **📤 Dropbox AutoUploader** node in your workflow to monitor and upload.
|
||||
|
||||
### 🚀 RunPod Environment Support
|
||||
|
||||
This package automatically detects RunPod environments and uses the correct proxy URL format for OAuth redirects. The system will:
|
||||
|
||||
- Detect `RUNPOD_POD_ID` environment variable
|
||||
- Generate redirect URI as `https://[POD_ID]-[PORT].proxy.runpod.net`
|
||||
- Fall back to `https://localhost` for local development
|
||||
|
||||
**Important**: When setting up your Dropbox app, make sure to add both redirect URIs:
|
||||
- `https://localhost` (for local development)
|
||||
- `https://[POD_ID]-8188.proxy.runpod.net` (for your specific RunPod instance)
|
||||
|
||||
---
|
||||
|
||||
|
||||
@@ -2,9 +2,16 @@
|
||||
|
||||
import base64
|
||||
import requests
|
||||
from .runpod_utils import get_redirect_uri, get_dropbox_authorization_url
|
||||
|
||||
APP_KEY = input("Enter your APP KEY: ")
|
||||
APP_SECRET = input("Enter your APP SECRET: ")
|
||||
|
||||
redirect_uri = get_redirect_uri()
|
||||
print(f"Using redirect_uri: {redirect_uri}")
|
||||
print(f"Authorization URL: {get_dropbox_authorization_url(APP_KEY)}")
|
||||
print()
|
||||
|
||||
AUTH_CODE = input("Paste the Dropbox authorization code: ")
|
||||
|
||||
auth_header = base64.b64encode(f"{APP_KEY}:{APP_SECRET}".encode()).decode()
|
||||
@@ -13,7 +20,7 @@ res = requests.post(
|
||||
data={
|
||||
"code": AUTH_CODE,
|
||||
"grant_type": "authorization_code",
|
||||
"redirect_uri": "https://localhost"
|
||||
"redirect_uri": redirect_uri
|
||||
},
|
||||
headers={
|
||||
"Authorization": f"Basic {auth_header}",
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
import os
|
||||
import requests
|
||||
from dotenv import load_dotenv, dotenv_values
|
||||
from .runpod_utils import get_redirect_uri
|
||||
|
||||
class DropboxSetupNode:
|
||||
@classmethod
|
||||
@@ -49,7 +50,8 @@ class DropboxSetupNode:
|
||||
"code": auth_code,
|
||||
"grant_type": "authorization_code",
|
||||
"client_id": app_key,
|
||||
"client_secret": app_secret
|
||||
"client_secret": app_secret,
|
||||
"redirect_uri": get_redirect_uri()
|
||||
}
|
||||
headers = {"Content-Type": "application/x-www-form-urlencoded"}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user