Skip to content
This repository has been archived by the owner on May 1, 2019. It is now read-only.

server side rendering #121

Open
luisrudge opened this issue Nov 2, 2016 · 5 comments
Open

server side rendering #121

luisrudge opened this issue Nov 2, 2016 · 5 comments

Comments

@luisrudge
Copy link
Contributor

I'm trying to use this lib with an universal app, but it's throwing an exception here because document is undefined when it's a server side render. Can we add a check to see if document exists or perhaps only run this code inside the constructor?

@luisrudge
Copy link
Contributor Author

luisrudge commented Nov 2, 2016

Actually, this happens in other places as well:

@kievechua
Copy link

Needed this as well, basically the document just used for injecting style.
Any timeframe we can expect? Or the team not plan to work on this at all?

@kievechua
Copy link

If your using next.js, check out this blog building-universal-apps-with-nextjs
Replace the cdn with this instead
<script src="http://cdn.auth0.com/js/lock-passwordless-2.2.3.min.js"></script>

@jensdotbruggeman
Copy link

I receive the same error, basically document is not defined using server side rendering.

For example , failing on document :
https://github.com/auth0/lock-passwordless/blob/master/src/atom/index.js#L3

how can I solve this? I use an Angular2 app combined with asp.NET Javascript services.

@luisrudge
Copy link
Contributor Author

To solve this, you have to make sure to require this lib only in the client. In angular, I think you can require it on dom load.

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

No branches or pull requests

3 participants