Skip to content

Conversation

@hrntknr
Copy link
Member

@hrntknr hrntknr commented Aug 20, 2025

Summary

Remove oauth2.AccessTypeOffline parameter from AuthCodeURL calls in both GitHub and Google OAuth providers. This parameter is not needed for the authorization code flow and may cause compatibility issues with some OAuth implementations.

Type of Change

  • fix: A bug fix

Related Issues

Changes Made

  • Removed oauth2.AccessTypeOffline from GitHub provider's AuthCodeURL method
  • Removed oauth2.AccessTypeOffline from Google provider's AuthCodeURL method

Testing

  • Existing tests pass
  • Manual testing of OAuth flows completed

Remove oauth2.AccessTypeOffline parameter from AuthCodeURL calls in both
GitHub and Google OAuth providers as it's not needed for the authorization
code flow and may cause issues with some OAuth implementations.
Copilot AI review requested due to automatic review settings August 20, 2025 11:13
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR removes the oauth2.AccessTypeOffline parameter from OAuth authorization code URL generation to fix compatibility issues with OAuth providers. The change affects both GitHub and Google OAuth implementations.

  • Removes oauth2.AccessTypeOffline from AuthCodeURL calls in OAuth providers
  • Simplifies OAuth flow implementation by removing unnecessary parameter
  • Addresses potential compatibility issues with OAuth implementations

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
pkg/auth/google.go Removes oauth2.AccessTypeOffline parameter from Google OAuth provider's AuthCodeURL method
pkg/auth/github.go Removes oauth2.AccessTypeOffline parameter from GitHub OAuth provider's AuthCodeURL method

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.


func (p *googleProvider) AuthCodeURL(c *gin.Context, state string) (string, error) {
authURL := p.oauth2.AuthCodeURL(state, oauth2.AccessTypeOffline)
authURL := p.oauth2.AuthCodeURL(state)
Copy link

Copilot AI Aug 20, 2025

Choose a reason for hiding this comment

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

Removing oauth2.AccessTypeOffline may prevent obtaining refresh tokens for Google OAuth. For Google's OAuth2 implementation, AccessTypeOffline is typically required to receive refresh tokens that allow offline access to user data. Consider if refresh token functionality is needed for this application.

Suggested change
authURL := p.oauth2.AuthCodeURL(state)
authURL := p.oauth2.AuthCodeURL(state, oauth2.AccessTypeOffline)

Copilot uses AI. Check for mistakes.
Copy link
Member Author

Choose a reason for hiding this comment

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

Refresh tokens are not used.

@codecov
Copy link

codecov bot commented Aug 20, 2025

Codecov Report

❌ Patch coverage is 0% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
pkg/auth/github.go 0.00% 1 Missing ⚠️
pkg/auth/google.go 0.00% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@hrntknr hrntknr merged commit a2d0d88 into main Aug 20, 2025
5 of 6 checks passed
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.

2 participants