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

Loading multiple tracks behind Google auth fails except for one #20

Open
siddharthab opened this issue Jun 18, 2024 · 6 comments
Open

Comments

@siddharthab
Copy link
Contributor

siddharthab commented Jun 18, 2024

When loading multiple tracks together using multiple calls to browser.loadTrack, I think the retry mechanism in igvxhr.js on a 401 works only for one in-flight promise, all the other in-flight promises will fail. Promises created after a successful signin will work.

@jrobinso
Copy link
Contributor

Thanks for the report. I will try to reproduce this. In the meantime the workaround is to load them serially, or initiate a login before attempting a load.

@siddharthab
Copy link
Contributor Author

Thanks @jrobinso for the quick response. As a workaround, I copy-pasted the getAccessToken function into my app, and I make my loadTrack calls in a .then block from the promise returned by getAccessToken.

@siddharthab
Copy link
Contributor Author

It will be nice if we could get a signIn function as part of the browser object. This will help with proactively signing in without having to copy/paste code from google-utils.

@jrobinso
Copy link
Contributor

What would the signature of the sign-in function be?

Many sites obtain the oAuth token by independent means, and simply set it using one of the methods here: https://github.com/igvteam/igv.js/wiki/OAuth-Support

I agree a signin function would be convenient.

@siddharthab
Copy link
Contributor Author

siddharthab commented Jun 18, 2024

Thank you! That wiki page is great; but a) I am new to JS and did not know how to write my own function, and b) it did not work for me on first try because of other issues (PRs merged today) so I gave up when I discovered that there is an inbuilt mechanism that activates on the first 401 received (only to come across the issue in this thread).

But maybe the best option would be if the wiki said at the end, something like:

// For default token retrieval logic.
igv.setGoogleOauthToken(igv.googleSignIn(scope)) // where googleSignIn is a new function.

// For custom token retrieval, provide your access token function, promise or string.
igv.setGoogleOauthToken(accessToken)

@jrobinso
Copy link
Contributor

jrobinso commented Jun 18, 2024

OK I'll give it some thought. You are in new territory, the code you are using was really designed for our web app, its not until now a public thing or part of our supported APIs. But if I can expose it cleanly will do so. I have some other priorities at the moment, just keep this open.

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