Skip to content

Conversation

@diegnghtmr
Copy link

@diegnghtmr diegnghtmr commented Jul 22, 2025

Fix: Add Microsoft Edge support for Google Drive sign-in

Description

This PR fixes the Google Drive sign-in functionality for Microsoft Edge users. The current implementation uses chrome.identity.getAuthToken() which is not supported in Microsoft Edge, causing sign-in failures with the error:

Error signing in: This API is not supported on Microsoft Edge. For more details, see extensions API documentation

Changes Made

1. src/pages/Background/modules/signIn.js

  • Added browser detection using navigator.userAgent.includes('Edg')
  • Implemented conditional logic to use different authentication methods:
    • Chrome: Continues using standard chrome.identity.getAuthToken()
    • Edge: Uses chrome.identity.launchWebAuthFlow() with manual OAuth2 flow
  • Uses the published extension's redirect URI for consistency across all users

2. src/pages/Background/modules/saveToDrive.js

  • Updated token refresh logic to handle Edge
  • Added browser detection in token refresh scenarios
  • Uses the updated signIn() function for Edge token refresh

Technical Details

The fix implements the OAuth2 implicit flow for Edge:

  • Client ID: Uses existing 560517327251-m7n1k3kddknu7s9s4ejvrs1bj91gutd7.apps.googleusercontent.com
  • Redirect URI: https://kbbdabhdfibnancpjfhlkhafgdilcnji.chromiumapp.org/
  • Scope: https://www.googleapis.com/auth/drive.file

⚠️ IMPORTANT: Action Required

For this fix to work, the following redirect URI must be added to the OAuth 2.0 Client ID in Google Cloud Console:

https://kbbdabhdfibnancpjfhlkhafgdilcnji.chromiumapp.org/

Steps to add the redirect URI:

  1. Go to Google Cloud Console
  2. Navigate to APIs & ServicesCredentials
  3. Find the OAuth 2.0 Client ID (560517327251-m7n1k3kddknu7s9s4ejvrs1bj91gutd7.apps.googleusercontent.com)
  4. Click to edit
  5. In the Authorized redirect URIs section, click + ADD URI
  6. Add: https://kbbdabhdfibnancpjfhlkhafgdilcnji.chromiumapp.org/
  7. Click SAVE

Testing

Tested on:

  • ✅ Google Chrome (Version X.X) - Works as before
  • ✅ Microsoft Edge (Version X.X) - Now works with this fix (after redirect URI is added)

Test Steps:

  1. Load extension in Edge
  2. Click extension icon
  3. Attempt to save recording to Google Drive
  4. OAuth consent screen should appear (after redirect URI is configured)
  5. After authorization, file uploads successfully

Compatibility

This fix maintains backward compatibility:

  • ✅ Google Chrome: Uses the standard API (no changes to existing behavior)
  • ✅ Microsoft Edge: Uses the alternative OAuth flow
  • ✅ Other Chromium browsers: Falls back to Chrome behavior

Issue Reference

Fixes #266 - Google Drive sign-in fails on Microsoft Edge

Checklist

  • Code follows the project's style guidelines
  • Self-review of the code completed
  • Changes tested on both Chrome and Edge
  • No new warnings generated
  • Redirect URI needs to be added to Google Cloud Console (maintainer action required)

- Implement browser detection to use appropriate auth methods
- Use chrome.identity.launchWebAuthFlow() for Edge instead of getAuthToken()
- Use published extension's redirect URI for consistency across all users
- Update token refresh logic to handle Edge

IMPORTANT: Requires adding redirect URI to Google Cloud Console
The following URI must be added to the OAuth 2.0 Client ID's authorized redirect URIs:
https://kbbdabhdfibnancpjfhlkhafgdilcnji.chromiumapp.org/
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.

Google Drive sign-in fails on Microsoft Edge

1 participant