refactor: rename auth_adobe.py to adobe_auth.py for naming consistency
Matches the naming convention of docusign_auth.py. Update all references in README.md and the error message in adobe_api.py. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
780099172f
commit
766986a795
|
|
@ -52,7 +52,7 @@ For production replace with `account.docusign.com` and your account's base URL (
|
|||
|
||||
**3. Authenticate with Adobe Sign** (one-time):
|
||||
```bash
|
||||
python3 src/auth_adobe.py
|
||||
python3 src/adobe_auth.py
|
||||
```
|
||||
Opens a browser. After authorizing, paste the redirect URL back into the terminal.
|
||||
Tokens are saved to `.env` and auto-refreshed on subsequent runs.
|
||||
|
|
@ -120,7 +120,7 @@ unexpected API behaviors, and the fixes applied.
|
|||
|
||||
```
|
||||
src/
|
||||
auth_adobe.py # One-time OAuth flow for Adobe Sign
|
||||
adobe_auth.py # One-time OAuth flow for Adobe Sign
|
||||
adobe_api.py # Adobe Sign API client (auto token refresh)
|
||||
download_templates.py # List and download templates from Adobe Sign
|
||||
compose_docusign_template.py # Core conversion: Adobe Sign → DocuSign JSON
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
One-time Adobe Sign OAuth setup.
|
||||
|
||||
Run this script once to authorize the app and save tokens to .env:
|
||||
python src/auth_adobe.py
|
||||
python src/adobe_auth.py
|
||||
|
||||
Prerequisites:
|
||||
- Set ADOBE_CLIENT_ID and ADOBE_CLIENT_SECRET in .env (or export them)
|
||||
|
|
@ -58,17 +58,34 @@ def exchange_code_for_tokens(code, client_id, client_secret):
|
|||
"client_secret": client_secret,
|
||||
}
|
||||
resp = requests.post(TOKEN_URL, data=data)
|
||||
if not resp.ok:
|
||||
print(f"ERROR: Token exchange failed ({resp.status_code}): {resp.text}")
|
||||
resp.raise_for_status()
|
||||
return resp.json()
|
||||
tokens = resp.json()
|
||||
print(f"Token exchange response keys: {list(tokens.keys())}")
|
||||
if "error" in tokens:
|
||||
raise ValueError(f"Adobe Sign returned error: {tokens.get('error')}: {tokens.get('error_description')}")
|
||||
return tokens
|
||||
|
||||
|
||||
def save_tokens(tokens):
|
||||
access_token = tokens.get("access_token", "")
|
||||
refresh_token = tokens.get("refresh_token", "")
|
||||
|
||||
if not access_token:
|
||||
raise ValueError("Adobe Sign did not return an access_token — not saving incomplete tokens")
|
||||
if not refresh_token:
|
||||
print("WARNING: Adobe Sign did not return a refresh_token — you will need to re-authenticate when the access token expires (~1 hour)")
|
||||
|
||||
abs_env = os.path.abspath(ENV_FILE)
|
||||
set_key(abs_env, "ADOBE_ACCESS_TOKEN", tokens["access_token"])
|
||||
if "refresh_token" in tokens:
|
||||
set_key(abs_env, "ADOBE_REFRESH_TOKEN", tokens["refresh_token"])
|
||||
set_key(abs_env, "ADOBE_ACCESS_TOKEN", access_token)
|
||||
if refresh_token:
|
||||
set_key(abs_env, "ADOBE_REFRESH_TOKEN", refresh_token)
|
||||
set_key(abs_env, "ADOBE_SIGN_BASE_URL", f"https://api.{SHARD}.adobesign.com/api/rest/v6")
|
||||
print(f"Tokens saved to {abs_env}")
|
||||
print(f"Access token saved (length={len(access_token)})")
|
||||
if refresh_token:
|
||||
print(f"Refresh token saved (length={len(refresh_token)})")
|
||||
print(f"Tokens written to {abs_env}")
|
||||
|
||||
|
||||
def main():
|
||||
Loading…
Reference in New Issue