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:
2026-06-19 21:12:43 +02:00
parent 122d00c8f9
commit 666369714b
4 changed files with 74 additions and 9 deletions

View File

@@ -1,7 +1,8 @@
package models
type Credentials struct {
RefreshToken string `json:"refresh_token"`
RefreshToken string `json:"refresh_token,omitempty"`
APIToken string `json:"api_token,omitempty"`
}
type TokenResponse struct {