-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FedCM] Prototype User Info API behind a flag (2/3)
User Info API can be used by IDPs to render personalized buttons. See proposal at w3c-fedid/FedCM#382. This patch: - Implement the proposal to return the requested user info. Next: - Add metrics and console logs This patch is built on top of crrev.com/c/4117510 Bug: 1304402 Change-Id: Iaee7a1b716b20182b56ebd484d3fecd03a31ba49 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4175904 Reviewed-by: David Bokan <bokan@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org> Reviewed-by: Ken Buchanan <kenrb@chromium.org> Commit-Queue: Yi Gu <yigu@chromium.org> Reviewed-by: John Abd-El-Malek <jam@chromium.org> Cr-Commit-Position: refs/heads/main@{#1095226}
- Loading branch information
1 parent
8b30abf
commit 3e84e83
Showing
4 changed files
with
97 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<!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}/\ | ||
credential-management/support/fedcm/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 | ||
}; | ||
window.top.postMessage(results, '*'); | ||
} catch (error) { | ||
window.top.postMessage({result: "Fail", errorType: error.name}, '*'); | ||
} | ||
}; | ||
|
||
</script> | ||
|