chromium/third_party/blink/web_tests/external/wpt/fedcm/support/fedcm/userinfo-iframe.html

<!doctype html>
<script type="module">
import {alt_manifest_origin} from './../fedcm-helper.sub.js';

// Loading fedcm-iframe.html in the test will make a FedCM call on load, and
// trigger a postMessage upon completion.
//
// message {
//   string result: "Pass" | "Fail"
//   string token: token.token
//   string errorType: error.name
// }
window.onload = async () => {
  try {
   const manifest_path = `${alt_manifest_origin}/\
fedcm/support/manifest.py`;
    const user_info = await IdentityProvider.getUserInfo({
      configURL: manifest_path,
      // Approved client
      clientId: '123',
    });
    let results = {
      result: "Pass",
      numAccounts: user_info.length,
      firstAccountEmail: user_info[0].email,
      firstAccountName: user_info[0].name,
      firstAccountGivenName: user_info[0].givenName,
      firstAccountPicture: user_info[0].picture
    };
    window.top.postMessage(results, '*');
  } catch (error) {
    window.top.postMessage({result: "Fail", errorType: error.name}, '*');
  }
};

</script>