-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
perform handshake from a content script rather than with scripting
In this commit, we remove the need for the background script to inject a function, and instead place a content script on every page the extension is active that the background script connects to in order to begin the flow. Here is a diagram of the flow now: 1. Background 2. Content Script 3. Content Script 4. SSO (current tab) (callback url) tabs.connect(...) ------> Create iFrame -------------┐ | runtime.onConnect(...) <--------------------- runtime.connect(...) | Asks for /authorize url | postMessage(...) -----------------------------> onMessage(...) ------> iframe | | disconnect() <--------------------------------- postMessage(...) --------┘ Code & State We also remove the need for the end user to add any code to (3), since by setting the new content script to be injected in all frames, it will also be injectend into the new iFrame that is created by (2). This also nicely matches with where the user of this library will need to get authentication tokens, as if they are performing an operation from a content script, then it will mean we will be able to grab a token from the same page that the user is currently active on which we are guaranteed to have access to.
- Loading branch information
Showing
6 changed files
with
144 additions
and
166 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
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 |
---|---|---|
@@ -1 +1 @@ | ||
export declare function handleTokenRequest(): Promise<void>; | ||
export declare function handleTokenRequest(redirectUri: string): void; |
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
Oops, something went wrong.