Skip to content

Conversation

@steve-calvert-glean
Copy link
Contributor

Summary

  • Add OAuth authentication documentation to Go, Java, Python, and TypeScript API client pages
  • Each language includes prerequisites, required headers, and complete authorization code flow examples
  • Examples use idiomatic OAuth libraries for each language (golang.org/x/oauth2, Spring Security, Authlib, openid-client)

Test plan

  • Verify documentation builds successfully with pnpm build
  • Review code examples for accuracy and best practices
  • Confirm links to admin configuration pages are correct

🤖 Generated with Claude Code

…uages

Add comprehensive OAuth authentication documentation to all four API client
libraries (Go, Java, Python, TypeScript). Each includes:

- Prerequisites and admin configuration links
- Required headers table (Authorization, X-Glean-Auth-Type)
- Complete authorization code flow example using idiomatic libraries
- Token refresh tips for production use

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@steve-calvert-glean steve-calvert-glean requested a review from a team as a code owner December 19, 2025 18:30
@vercel
Copy link

vercel bot commented Dec 19, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
glean-developer-site Ready Ready Preview, Comment Dec 19, 2025 7:58pm

Address PR review feedback:

- TypeScript: Add PKCE (code_challenge, code_verifier) and state
  verification using openid-client v6 correct API
- Java: Fix Spring Security YAML structure with proper named
  registration/provider ("glean") and authorization-grant-type
- Go: Add cryptographic state generation and validation to prevent
  CSRF attacks (was using hardcoded "state")

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
ClientID: os.Getenv("OAUTH_CLIENT_ID"),
ClientSecret: os.Getenv("OAUTH_CLIENT_SECRET"),
RedirectURL: "http://localhost:8080/callback",
Scopes: []string{"openid", "email"},

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

3/5 (strong opinion: non-blocking)

This should include offline_access to showcase getting a refresh token

Comment on lines 348 to 362
func handleLogin(w http.ResponseWriter, r *http.Request) {
state, err := generateState()
if err != nil {
http.Error(w, "Failed to generate state", http.StatusInternalServerError)
return
}

// Store state for CSRF validation
stateMu.Lock()
stateStore[state] = true
stateMu.Unlock()

url := oauthConfig.AuthCodeURL(state)
http.Redirect(w, r, url, http.StatusTemporaryRedirect)
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

4/5 (serious issue: blocking)

Have we validated this code works? We're OAuth 2.1 so state is optional and not even recommended but PKCE is required.

That we're generating a state suggests we might be not generating a PKCE challenge.

- Go: Use correct Search.Query() with components.SearchRequest,
  add PKCE with oauth2.GenerateVerifier/S256ChallengeOption/VerifierOption
- Java: Add Spring Security PKCE config, use correct search().query() API
- Python: Add PKCE via code_challenge_method='S256', use models.SearchRequest
- TypeScript: Use correct search.query() API (not search.search())

All examples now use real SDK APIs verified from GitHub READMEs and include
proper PKCE implementation for secure OAuth flows.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants