Chrome Extension OAuth Callback

How do i handle the ott code http://localhost/ext/callback?ott=mZ_tdIZjcP5KR4P5toK9epJWdniZNcM9
2 Replies
Barrel Of Lube
Barrel Of LubeOP3w ago
background:
// check if the url is a callback url
chrome.tabs.onUpdated.addListener((tabId, changeInfo, tab) => {
if (changeInfo.status === 'complete' && tab.url?.includes('localhost/ext/callback')) {
chrome.runtime.sendMessage({
action: 'oauthCallback',
data: tab.url,
});
}
});
// check if the url is a callback url
chrome.tabs.onUpdated.addListener((tabId, changeInfo, tab) => {
if (changeInfo.status === 'complete' && tab.url?.includes('localhost/ext/callback')) {
chrome.runtime.sendMessage({
action: 'oauthCallback',
data: tab.url,
});
}
});

Did you find this page helpful?