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

[RFC] Redirection to login should be done in the authProvider #2957

Closed
fzaninotto opened this issue Mar 4, 2019 · 7 comments
Closed

[RFC] Redirection to login should be done in the authProvider #2957

fzaninotto opened this issue Mar 4, 2019 · 7 comments

Comments

@fzaninotto
Copy link
Member

Problem

If the authProvider delegates login and check to a third-party server (e.g. OAuth), then it should be able to manage the login form URL.

Currently, the login form URL is hardcoded. The only possibility to redirect to an external authentication server is to use window.location in AUTH_LOGOUT, which occurs after a first redirection to '/login' in case of voluntary disconnection. That creates a blinking screen.

extract from the current auth saga:

case USER_CHECK: {
    try {
        yield call(authProvider, AUTH_CHECK, payload);
    } catch (error) {
        yield call(authProvider, AUTH_LOGOUT);
        yield put(
            replace({
                pathname: (error && error.redirectTo) || '/login',
                state: { nextPathname: meta.pathName },
            })
        );
    }
    break;
}
case USER_LOGOUT: {
    yield put(
        push(
            (action.payload && action.payload.redirectTo) ||
                '/login'
        )
    );
    yield call(authProvider, AUTH_LOGOUT);
    break;
}

Solution

The auth saga should not do the redirection by itself, but use the return object from AUTH_LOGOUT as login URL.

This is a breaking change.

@calebfaruki
Copy link

Has there been any progress on making this change?

@fzaninotto
Copy link
Member Author

No, as it's a breaking change, it can only occur in a major release. Development for 3.0 has just started on the next branch.

@deksden
Copy link

deksden commented May 7, 2019

Complete Oauth (social login via Facebook/Instagram?) example will be extremely welcome!

@mnlbox
Copy link
Contributor

mnlbox commented Jul 8, 2019

I also recommend to add some example about authentication servers like Keycloak It's support OpenID Connect protocol.

@fzaninotto
Copy link
Member Author

Fixed by #3269

@Nefcanto
Copy link

I found this issue from Google search. It seems that the implementation has a bug.

I reported this in this issue.

@fzaninotto
Copy link
Member Author

Implemented in #6326, which was released in 3.17.0.

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

No branches or pull requests

5 participants