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

Bugfix for WebExtension #1750

Merged
merged 3 commits into from
Nov 28, 2019
Merged

Bugfix for WebExtension #1750

merged 3 commits into from
Nov 28, 2019

Conversation

STK913
Copy link
Contributor

@STK913 STK913 commented Nov 12, 2019

Can you approve this change to handle WebExtensions, please? The auth0-lock and auth0-js projects are affected by this change. I used auth0-chrome which is supposed to work for the extensions, but this library is not adapted and poses problems of ergonomics.
Thanks in advance.

Can you approve this change to handle WebExtensions, please? The auth0-lock and auth0-js projects are affected by this change. I used auth0-chrome which is supposed to work for the extensions, but this library is not adapted and poses problems of ergonomics.
Thanks in advance.
@STK913 STK913 requested a review from a team November 12, 2019 16:46
@damieng
Copy link
Contributor

damieng commented Nov 14, 2019

I think we need more information as to exactly what is broken here. We need to be able to repro the issue first. Typically a PR like this is attached to an issue that gives the right context.

@STK913
Copy link
Contributor Author

STK913 commented Nov 14, 2019

I created an example project here: https://github.com/STK913/WebExtensionForAuth0

Edit the AUTH0_CLIENT_ID and AUTH0_DOMAIN variables in variables.ts.
Download NPM packages: npm i
Since this is an Ionic/Angular project, you will need to run this command: npm install -g ionic
Then start the project: ionic serve
The project should be compiled and accessible from: http://localhost:8100
But what interests us is the extension, so go to the list of extensions in Google Chrome: chrome://extensions/
Display developer mode with the check box at the top right.
Load the unpackaged extension that corresponds to this folder: www
Get the extension ID from chrome://extensions/ to add it to the Auth0 application configuration:

  • Add in "Allowed Callback URLs": chrome-extension://EXTENSION_ID/index.html
  • Add in "Allowed Web Origins": chrome-extension://EXTENSION_ID
  • Add in "Allowed Origins (CORS)": chrome-extension://EXTENSION_ID

Open the extension from the browser icon (next to the address bar).
Try to log in with your Auth0 credentials and you will see that the spinner is running in a loop because of the following error:
ERROR TypeError: Cannot read property 'protocol' of null
at Object.getOriginFromUrl (vendor.js:100277)

Modify directly www/vendor.js and apply the patch in the getLocationFromUrl method as I did in my commit (in 3 places).
Reinstall the extension again and you will be able to connect.

Ps: I also created a request here: auth0/auth0.js#1054

@stevehobbsdev stevehobbsdev added this to the vNext milestone Nov 28, 2019
@stevehobbsdev
Copy link
Contributor

Thanks for your contribution @STK913. For issues like this in the future we'd appreciate an issue first to discuss a potential fix, and move on from there.

@stevehobbsdev stevehobbsdev merged commit 53d7e4d into auth0:master Nov 28, 2019
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

Successfully merging this pull request may close these issues.

4 participants