feat: add --api flag for Canvas API token authentication
- Add APIToken field to Credentials struct with omitempty JSON tag - Implement GetAPIToken() method with persistent token storage - Add SaveRefreshToken() helper to preserve API tokens during OAuth - Implement --api CLI flag to use API token instead of OAuth - Validate empty refresh tokens and skip refresh if invalid - Update README with API token usage documentation
This commit is contained in:
12
README.md
12
README.md
@@ -26,9 +26,14 @@ go build -o canvasarchiver ./cmd/canvasarchiver
|
||||
./canvasarchiver -fo
|
||||
```
|
||||
|
||||
Or for videos-only mode (all Panopto videos flat, no files):
|
||||
Or for videos-only mode (all Panopto videos flat, no files):
|
||||
```bash
|
||||
./canvasarchiver -vo
|
||||
```
|
||||
|
||||
Or to use a manually generated Canvas API token:
|
||||
```bash
|
||||
./canvasarchiver -vo
|
||||
./canvasarchiver --api
|
||||
```
|
||||
|
||||
2. On first run, you'll be prompted to authenticate:
|
||||
@@ -53,6 +58,7 @@ go build -o canvasarchiver ./cmd/canvasarchiver
|
||||
| `-vo` | Videos only — scan recordings and all module video items, download everything flat into one directory; skips regular files |
|
||||
| `-me` | Download all enrolled courses |
|
||||
| `-n` | Prefix modules with order numbers `[1]`, `[2]`, etc. |
|
||||
| `--api` | Use a manually generated Canvas API token instead of OAuth |
|
||||
|
||||
|
||||
## Configuration
|
||||
@@ -68,6 +74,8 @@ The following constants can be modified in `internal/config/config.go`:
|
||||
|
||||
Credentials are stored in `credentials.json` after the first successful login. The refresh token is automatically used for subsequent runs.
|
||||
|
||||
With `--api`, enter a manually generated Canvas API token on first use. It is saved to `credentials.json` and reused on later `--api` runs.
|
||||
|
||||
## Notes
|
||||
|
||||
- Files are organized to match Canvas structure
|
||||
|
||||
Reference in New Issue
Block a user