Project

General

Profile

Actions

Bug #17101

closed

Google/OIDC login doesn't navigate user back to original path

Added by Peter Amstutz almost 4 years ago. Updated almost 4 years ago.

Status:
Resolved
Priority:
Normal
Assigned To:
Category:
Workbench2
Target version:
Story points:
-
Release relationship:
Auto

Description

The user can copy the wb2 path (a project or collection) from the URL bar and send it to another user. The 2nd user clicks on it, but need to log in. After the user logs in, they are shown the default starting view, not the project or collection they intended to visit.

Fixing this will make it easier for users to share URLs to collections, as well as making the implementation of "copy to clipboard" and "open in new tab" for projects/collections much simpler.

This happens because the AuthService.login (src/services/auth-service/auth-service.ts) method does not record the path that the user intended to navigate to. It sends the user to the 3rd party login, and the token is returned by redirecting the browser to the /token endpoint, which saves the token, and then the user is shown the default page.

The login method should provides a means of returning to the desired location. This means stashing the current path and query parameters in one of two places:

  • embedded in the URL that will be sent to the login server as return_to.
    The way return_to is used is that the upstream Arvados API server redirects the browser to the URL in "return_to" and adds "api_token=xxx" query parameter. This would require check for "api_token" in the query during initialization and not just when navigating to the "token" endpoint.
  • browser storage (session storage?) so that when returning to the page, it restores the original path and query.

Subtasks 1 (0 open1 closed)

Task #17102: ReviewResolvedDaniel Kutyła11/11/2020Actions
Actions #1

Updated by Peter Amstutz almost 4 years ago

  • Description updated (diff)
Actions #2

Updated by Peter Amstutz almost 4 years ago

  • Description updated (diff)
Actions #3

Updated by Peter Amstutz almost 4 years ago

  • Description updated (diff)
Actions #5

Updated by Daniel Kutyła almost 4 years ago

  • Status changed from New to In Progress
Actions #6

Updated by Peter Amstutz almost 4 years ago

It wasn't working consistently. Sometimes it would go to the correct page, sometimes it wouldn't.

On investigation, and it seems like setting window.location.href causes a page reload, and there is some kind of race condition where on the reload it would sometimes call ApiToken.componentDidMount leading to calling getTargetURL() again, but on the second time it would come back as null, so it then it would call navigateToRootProject. But this doesn't happen consistently.

I fixed this by calling replace() from react-redux-router, which doesn't trigger a page reload. I also changed the value stored in TargetURL to be just the path and query string.

17101-login-doesnt-navigate-user-back-to-original-path @ arvados-workbench2|54e734a4074911ce516a65c7195c84ad523adc75

developer-tests-workbench2: #171

Take a look at my changes and if you don't have any issues with it, please merge.

Actions #7

Updated by Daniel Kutyła almost 4 years ago

  • % Done changed from 0 to 100
  • Status changed from In Progress to Resolved
Actions #8

Updated by Peter Amstutz almost 4 years ago

  • Release set to 36
Actions

Also available in: Atom PDF