Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support external step for login flow #23204

Open
wants to merge 7 commits into
base: dev
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/auth/ha-auth-external.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,13 @@ export class HaAuthExternal extends HaForm {

protected firstUpdated(changedProps) {
super.firstUpdated(changedProps);
window.open(this.step.url);
const source = window.open(this.step.url);
allenporter marked this conversation as resolved.
Show resolved Hide resolved
window.addEventListener("message", async (message: MessageEvent) => {
if (message.data.type === "externalCallback") {
if (
message.origin === window.location.origin &&
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The message is sent from the external site right? So the origin would something like this.step.url?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It appears to always be the home assistant url e.g. http://localhost:8123 when i'm testing, and not as the external IDP.

message.source === source &&
message.data.type === "externalCallback"
) {
fireEvent(this, "step-finished");
}
});
Expand Down