feat: interactive auth method selection with API token validation

- Add GetToken() as unified auth entry point with method selection
- Prompt [1] OAuth / [2] API token on first launch, save choice
- Validate API tokens against /api/v1/users/self before saving
- Check saved API token validity on reuse; fallback to re-prompt on failure
- Add HTTP status check to GetCourseInfo and GetEnrolledCourses
- Remove --api flag, auth method is now persistent and interactive
This commit is contained in:
2026-06-19 21:17:00 +02:00
parent 666369714b
commit 07fade16d3
5 changed files with 89 additions and 32 deletions

View File

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