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

Error "Cannot read properties of null" when trying to login in the widget #1285

Open
erezsh opened this issue Jan 29, 2023 · 2 comments
Open

Comments

@erezsh
Copy link

erezsh commented Jan 29, 2023

When running in a chrome browser extension, in the options page, I can get the widget to load and run, but when trying to connect, I get this error: TypeError: Cannot read properties of null (reading '0') at R.authorize

I would debug it further but I'm not sure where to start.

This is the code I'm using to load the widget:

const remoteStorage = new RemoteStorage({logging: true});
remoteStorage.access.claim('bookmarks', 'rw');
remoteStorage.caching.enable('/bookmarks/')

import Widget from 'remotestorage-widget'
const widget = new Widget(remoteStorage);
widget.attach();

And this is how it looks: (stuck loading + error)

image

@erezsh
Copy link
Author

erezsh commented Jan 29, 2023

Update: In Firefox I'm getting the same behavior, but a different error: TypeError: b.redirectUri.match(...) is null

@raucao
Copy link
Member

raucao commented Jan 30, 2023

The widget is currently not prepared for use in browser extensions. See #1205 for a detailed explanation.

I would recommend to forgo the widget, and implement the RS connect UI yourself. Have a look at the widget source code to see how this can be done. It's actually quite simple. (The widget only uses public APIs of remoteStorage.js.)

Feel free to ask any questions on the way, if you try this route. Maybe we can turn it into a documentation page for this topic.

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

No branches or pull requests

2 participants