Giter Site home page Giter Site logo

Comments (5)

ctron avatar ctron commented on July 30, 2024

The redirect URL is actually constructed from the current URL:

yew-oauth2/src/agent/mod.rs

Lines 378 to 384 in 06a652f

fn current_url() -> Result<Url, String> {
let href = window().location().href().map_err(|err| {
err.as_string()
.unwrap_or_else(|| "unable to get current location".to_string())
})?;
Url::parse(&href).map_err(|err| err.to_string())
}

But I agree, it might make sense to be able to override this.

There are different ways to deal with this. This could be configured in the oauth2 main configuration, via an optionally provided URL. Or using an optionally provided relative URL maybe. It could also be provided in the LoginOptions struct. What do you think?

from yew-oauth2.

kpupkov-ppa avatar kpupkov-ppa commented on July 30, 2024

@ctron I think more convenient way is to have it at Client config level. You concept of 'Additional', right? That make sense to me put ALL optional additional configurations into this structure with 'predefined' default values. Any other solutions will be less attractive to me.
#[cfg(feature = "openid")] let config = Config { client_id: "XYZ".into(), //Rust OKTA as SPA configuration issuer_url: "https://XYZ-dev.okta.com/oauth2/default".into(), additional: Additional { /* Set the after logout URL to a public URL. Otherwise, the SSO server will redirect back to the current page, which is detected as a new session, and will try to login again, if the page requires this. */ end_session_url: None, after_logout_url: Some("/".into()), post_logout_redirect_name: Some("/".into()), redirect_uri: Some("/login/oauth2/code/okta".into()), ///Other Okta related configs }, };

from yew-oauth2.

ctron avatar ctron commented on July 30, 2024

Yea, that is true. However, we already have the scope on the OAuth2 component properties level (as it is the same for both OAuth2 and OIDC). And now the same for the audience.

However, that doesn't matter as a default can be defined using #[prop_or_default] (or similar attributes).

Maybe it makes sense to define this as Option on both the OAuth2 properties, as well as the LoginOptions, defaulting to the current behavior.

from yew-oauth2.

kpupkov-ppa avatar kpupkov-ppa commented on July 30, 2024

@ctron I don't want to limit you in solution. It makes sense to me for any convenient approach. Just provide in doc several examples how to configure for different use cases.

from yew-oauth2.

ctron avatar ctron commented on July 30, 2024

I won't promise anything, but if you have some time, a PR would definitely help.

from yew-oauth2.

Related Issues (18)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.