I have a Chrome extension MV3 for which I need to implement Apple Sign in. Apparently it is not possible yet to use the Firebase Auth service to implement 3rd party oauths because popups/redirects (needed for Apple Sign in) are currently not supported in MV3 (read here & here & here). I am therefore trying to set up Apple Sign in manually using the Chrome Identity API. The code looks like this (sensitive values X'ed out):
const requestURL =
'https://appleid.apple.com/auth/authorize?client_id=XXXXXXXXXXXXXXXXX&redirect_uri=https://XXXXXXXXXXX.chromiumapp.org&response_mode=form_post&response_type=code%20id_token&scope=email';
chrome.identity.launchWebAuthFlow(
{ url: requestURL, interactive: true },
function (redirectURL) {
console.log('redirectURL: ' + redirectURL);
// How to extract the HTTP body of the response here??
}
);
The above authorization request to Apple is working (a popup window appears for Apple sign in, I can submit my sign-in credentials, and so on). Then when Apple completes the authorization, the response back from Apple is an HTTP POST request to my redirectURI and with the body of that HTTP POST supposedly containing the result parameters (id_token, user object, etc).
My question: how do I extract/read those result parameters from the body of that HTTP POST request that I receive in my redirectURI? I seen answers like this but am none the wiser.