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

Redirect confusion when multiple configs are in use #43

Open
chrysn opened this issue Nov 20, 2024 · 2 comments
Open

Redirect confusion when multiple configs are in use #43

chrysn opened this issue Nov 20, 2024 · 2 comments

Comments

@chrysn
Copy link

chrysn commented Nov 20, 2024

In a setup with parallel possible logins, once in a while (my guess: if the hashmap backing them happens to sort them in the wrong way), attempting to log in in one of two configured OAuth2 providers results in an error message at the other one (with "Server returned error response", which is not surprising given they got somehow mixed up).

The setup involves a field in the model

oauth_configs: std::collections::HashMap<std::rc::Rc<str>, yew_oauth2::openid::Config>,

and a loop in the view:

{ for self.oauth_configs.iter().map(|(key, config)| {
    html! { <li key={key.clone()}>
        <OAuth2 config={config.clone()}>
            <LoginView uri={key.clone()} on_access_token_available={ link.callback(Message::AsTokenAvailable) } />
        </OAuth2>
    </li> }
})}

For the moment I work around this by enabling them only on demand; I plan on digging down to this later. (Right now the usefulness of having multiple providers is limited; [edit] once #42 is added, this should be different.)

@ctron
Copy link
Owner

ctron commented Nov 20, 2024

I am not sure I fully understand this. the OAuth2 component injects the context holding the state. That's accessible by all children of this component.

@chrysn
Copy link
Author

chrysn commented Nov 20, 2024

AIU this is not about the context injected, but about how the data that comes in through the yew-nested-router feature is sent to one or the other OAuth instance. (The only relevant children I have in there are the usual Authenticated / NotAuthenticated / Failure children).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants