mirror of
https://gh-proxy.org/https://github.com/klinsmaya/CLIProxyAPI.git
synced 2026-11-10 02:16:49 +08:00
- Replaced PKCE-based OAuth for xAI with device authorization flow for enhanced compatibility. - Introduced cancelable OAuth sessions with server-side invalidation to prevent token persistence on flow interruption. - Updated OAuth polling and session tracking to handle device flow specifics, such as `user_code` and extended timeouts. - Refactored TUI OAuth model to track polling generations, distinguish device flow, and handle session cancellation gracefully. - Extended test cases for device flow scenarios, stale session handling, and cancelation logic. - Streamlined xAI device flow management in handler logic and improved error handling.
15 lines
382 B
Go
15 lines
382 B
Go
package auth
|
|
|
|
import "testing"
|
|
|
|
func TestXAIAuthenticatorProviderAndRefreshLead(t *testing.T) {
|
|
authenticator := NewXAIAuthenticator()
|
|
if authenticator.Provider() != "xai" {
|
|
t.Fatalf("Provider() = %q, want xai", authenticator.Provider())
|
|
}
|
|
lead := authenticator.RefreshLead()
|
|
if lead == nil || *lead <= 0 {
|
|
t.Fatalf("RefreshLead() = %v, want positive duration", lead)
|
|
}
|
|
}
|