Open schlegelp opened 2 years ago
After opening this issue, I remembered that I had a similar issue with DVID a long while back.
I managed to get it to work like so:
from neuroglancer import credentials_provider
from neuroglancer.futures import run_on_new_thread
from neuroglancer.default_credentials_manager import default_credentials_manager
class TokenbasedDefaultCredentialsProvider(credentials_provider.CredentialsProvider):
def __init__(self):
super(TokenbasedDefaultCredentialsProvider, self).__init__()
self._credentials = {}
self._credentials['token'] = 'MY_FLYWIRE_API_TOKEN'
def get_new(self):
def func():
return dict(tokenType=u'Bearer', accessToken=self._credentials['token'])
return run_on_new_thread(func)
_global_tokenbased_application_default_credentials_provider = None
def get_tokenbased_application_default_credentials_provider():
"""Copy pasted from neuroglancer."""
global _global_tokenbased_application_default_credentials_provider
if _global_tokenbased_application_default_credentials_provider is None:
_global_tokenbased_application_default_credentials_provider =\
TokenbasedDefaultCredentialsProvider()
return _global_tokenbased_application_default_credentials_provider
# Register authentication
default_credentials_manager.register(
u'middleauthapp',
lambda _parameters: get_tokenbased_application_default_credentials_provider())
# Start viewer
viewer = neuroglancer.Viewer()
So this works but is there a way to get the snazzy dynamic Google auth login?
@chrisj When using the Python integration, a separate implementation is required for each authentication method. The normal authentication method depends on Neuroglancer being hosted at an origin (host and port) that is specifically allowed by the authentication server.
Hi @jbms and @chrisj!
Thanks for adding support for graphen sources - I've been really excited to take this for a spin! Off the bat I'm running into an issue with a locally-run neuroglancer viewer though (probably missing something).
Here's a minimal example:
When I then pull up the browser and add
graphene://middleauth+https://prod.flywire-daf.com/segmentation/1.0/fly_v31
as layer I get this error:This is using the wheel for
neuroglancer-2.26.post1.dev10
from build 359.I'm guessing I need to manually add something here? Any ideas?
Thanks, Philipp