Skip to content

Commit

Permalink
feat: warn on bad origin (#549)
Browse files Browse the repository at this point in the history
* feat: warn on bad origin

This adds a debug message in case II is replying with a bad origin.

* Update packages/auth-client/src/index.ts

Co-authored-by: Kyle Peacock <kylpeacock@gmail.com>
  • Loading branch information
nmattia and krpeacock committed Mar 30, 2022
1 parent a7c8088 commit bc098bf
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions packages/auth-client/src/index.ts
Expand Up @@ -307,6 +307,7 @@ export class AuthClient {
private _getEventHandler(identityProviderUrl: URL, options?: AuthClientLoginOptions) {
return async (event: MessageEvent) => {
if (event.origin !== identityProviderUrl.origin) {
console.warn(`WARNING: expected origin '${identityProviderUrl.origin}', got '${event.origin}' (ignoring)`);
return;
}

Expand Down

0 comments on commit bc098bf

Please sign in to comment.