히스토리
- 이거 매우 중요해.
관련메타
관련노트
- 1j2c †#메멕스#셀프트레킹
- §memex-kb: Legacy 문서 RAG 파이프라인 입구
- #셀프트레킹 #메맥스 Quantified-self
- ¤gitleaks ¤secretlint 시크릿린트 - 리포 보안 정보 삭제 정리
Threads API 토큰 갱신 및 memex-kb Flake 전환
배경
memex-kb 프로젝트의 Threads API 토큰이 만료되어 갱신 작업 진행. 기존 방법(User Token Generator)이 작동하지 않아 새로운 방법 발견.
핵심 발견: Graph API Explorer + threads.net API
토큰 발급 방법 (2026-01-21 검증)
-
Graph API Explorer 접속
-
중요: 상단 드롭다운에서 API를
threads.net으로 변경- 기본값은
graph.facebook.com이라 작동 안 함
- 기본값은
-
“Generate Access Token” 클릭 → 단기 토큰 획득
-
장기 토큰(60일)으로 교환:
nix develop --command python scripts/refresh_threads_token.py --exchange "단기토큰"
왜 User Token Generator는 안 됐나
- 테스터 계정 매칭 문제
- “Invalid Auth Code: Credentials entered do not match the selected tester profile”
- Meta의 복잡한 계정 체계 (Facebook/Instagram/Threads)
memex-kb 개선 작업
1. Nix Flake 전환
shell.nix → flake.nix 전환으로 빌드 속도 개선.
# 이전 (느림 - 매번 nixpkgs 평가)
nix-shell --run "python scripts/..."
# 이후 (빠름 - 캐싱)
nix develop --command python scripts/...2. 토큰 갱신 스크립트 생성
scripts/refresh_threads_token.py 생성:
# 단기 → 장기 토큰 교환 (가장 많이 사용)
python refresh_threads_token.py --exchange "THAA..."
# 현재 토큰 테스트
python refresh_threads_token.py --test
# 기존 장기 토큰 갱신 (만료 전)
python refresh_threads_token.py3. secretlint → gitleaks 교체
npm 의존성 제거, Nix로 통합.
# git repo 스캔
gitleaks detect
# 일반 파일 스캔 (디지털 가든 배포 전 검사용)
gitleaks detect --source=/path/to/files --no-git4. direnv 연동
.envrc 추가로 디렉토리 진입 시 자동 환경 로드.
삭제된 파일
shell.nix→flake.nix로 대체requirements.txt→flake.nix에서 Python 패키지 관리package.json,package-lock.json→gitleaks로 대체
스레드 내보내기 파이프라인
내보내기 명령
nix develop --command python scripts/threads_exporter.py --download-images출력 위치
- memex-kb:
docs/threads-aphorisms.org - 디지털 가든 배포용: 힣 모음 - 어쏠리즘/아포리즘
60일 후 갱신 체크리스트
[ ] 1. Graph API Explorer 접속
https://developers.facebook.com/tools/explorer/1351795096326806/
[ ] 2. API를 "threads.net"으로 변경
[ ] 3. Generate Access Token → 단기 토큰 복사
[ ] 4. 장기 토큰 교환:
nix develop --command python scripts/refresh_threads_token.py --exchange "토큰"
[ ] 5. 테스트:
nix develop --command python scripts/refresh_threads_token.py --test커밋
- 커밋:
7007e92 - 메시지: “refactor: Migrate to Nix flake and add Threads token refresh script”
Comments