Open siddharthab opened 3 weeks ago
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.
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
.
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.
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.
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)
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.
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.