feat(provider): add github copilot device flow provider (#364)

This commit is contained in:
LiBr
2026-04-13 19:38:33 +08:00
committed by GitHub
parent a40207ab6d
commit df8fbd8859
36 changed files with 2659 additions and 246 deletions
+21
View File
@@ -0,0 +1,21 @@
package oauthctx
import (
"context"
"strings"
)
type userIDContextKey struct{}
func WithUserID(ctx context.Context, userID string) context.Context {
userID = strings.TrimSpace(userID)
if userID == "" {
return ctx
}
return context.WithValue(ctx, userIDContextKey{}, userID)
}
func UserIDFromContext(ctx context.Context) string {
userID, _ := ctx.Value(userIDContextKey{}).(string)
return strings.TrimSpace(userID)
}