`identity.launchWebAuthFlow()` is not opening provided URL in Android Edge
Description
When using identity.launchWebAuthFlow() (MDN) in Android Edge throws following error in console and flow is not started:
# Most of the time it throws this error:
Couldn't create a browser window to display an authorization page
# Rarely but it might throw this error too:
identity.launchWebAuthFlow not implemented
In desktop Edge it works fine and as expected.
I suppose it's bug because in Supported APIs page in identity row Android is listed in platforms.
I appreciate if you provide any workaround to mitigate this issue.
Steps to Reproduce
- Place all of the files below in one directory
- Create
crxfile from this directory - Enable developer mode in Android Edge
- Go to Settings -> Developer Options -> Install extension by crx
- Select
crxfile - Open extension's popup page
- Click on button
- Error thrown in console
manifest.json:
{
"name": "OAuth Extension",
"description": "Test Identity API",
"version": "1.0.0",
"manifest_version": 3,
"action": {
"default_popup": "index.html"
},
"permissions": [
"identity"
]
}
index.html:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
body {
width: 300px;
height: 300px;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
row-gap: 10px;
}
button {
background: black;
color: #ffffff;
padding: 10px 20px;
border: none;
cursor: pointer;
transition: all 0.3s ease;
border-radius: 30px;
font-weight: 700;
}
button:hover {
background: #488202;
}
</style>
</head>
<body>
<h1>Identity API Login</h1>
<button id="auth-btn">identity.launchWebAuthFlow()</button>
<script type="text/javascript" src="./index.js"></script>
</body>
</html>
index.js:
async function initiateOAuthFlow() {
// Get the redirect URL for the OAuth flow
const redirectUrl = chrome.identity.getRedirectURL('callback');
// Initiate the OAuth flow
const responseUrl = await chrome.identity.launchWebAuthFlow({
url: 'https://example.org?redirect_url=' + encodeURIComponent(redirectUrl),
interactive: true,
abortOnLoadForNonInteractive: true,
timeoutMsForNonInteractive: 60000,
});
// When the OAuth flow is complete, the response URL will contain the access token
console.log('Response URL:', responseUrl);
}
document.getElementById('auth-btn').onclick = initiateOAuthFlow;
Platform Info
Tested on:
- Browser: Microsoft Edge 141.0.3495.0 (Official build) canary (64-bit)
- Chromium version: 141.0.7342.0
- OS: Android 16 (Build/BP22.250221.010)
- JavaScript engine: V8 14.1.1
- User Agent: Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Mobile Safari/537.36 EdgA/141.0.0.0
Hi @kurrx
I am Rahul from the Microsoft Edge Extensions Developer Support team.
Thank you for reporting this issue. I’m currently reviewing the details to determine how best to assist you with a resolution. I’ll keep you updated as soon as I have more information, and I’ll reach out if I need anything further from your side to help resolve the issue.