Hacker News new | past | comments | ask | show | jobs | submit | brimtown's comments login

I work in this building - it’s a wonderful experience walking through it every morning, and will be sad to see it go!


You might be interested in https://www.datadoghq.com/blog/engineering/computing-accurat...

Disclaimer: I work there/built the TypeScript implementation of the library



> Q: If I have to include this token with every request, where should I store it?

> A: Typically, you would store it in the localStorage, after the user logs in and gets the token.

This seems to contradict Auth0's guidance to not store tokens in localStorage since it's vulnerable to XSS: https://auth0.com/docs/security/store-tokens#don-t-store-tok...


Yes, but when the server does not send the token as cookie the only option is to store it with JavaScript. And yes, that also means (any) JavaScript can access the token.


Thanks for the insight! If anyone cares to provide any clue about best practices and how to handle token storage, you are more than welcomed to provide any insight.


Here you go: https://auth0.com/docs/security/store-tokens

Gives various suggestions depending on your use case.


I've been looking at this for months without getting a clear, noncontroversial answer. Even with this documentation, it is still unclear what to do if you have a SPA on another host than your backend (so you can't use cookies), and you do not want to use server sessions. Using `oidc-client` from the frontend could work, but that bundle size[0] is absolutely insane.

[0]: https://bundlephobia.com/result?p=oidc-client@1.9.1


Dan Abramov's is very good: https://overreacted.io/


Sharing a blog post that my team wrote on some of the benefits we saw from using Gatsby / a static frontend architecture when building https://shopflamingo.com: https://medium.com/harrys-engineering/how-we-used-gatsby-js-...

In short, being able to scale to as many requests as your CDN can handle, with none of the operational overhead of a traditional web server, is really really nice.


Thanks for that post. That is impressive that you went with the best/fastest tech available today rather than just leverage what was done with Harrys. I am interested with what you actually used for the e-commerce part of it. Are you interacting with your systems that you made for Harrys with GraphQL or did you use a JAM stack orientated solution like gocommerce?


Thank you! We have plans to build many more frontends in the coming years, so it felt like an appropriate time to step back and see what other solutions were out there.

For the e-commerce part of it, it's a custom API written in Scala that handles our inventory, warehouse, and fulfillment needs. As well as interfacing with Stripe for actual order processing. Want to get that team to write their own blog post as several people have asked about it!


The Dynamicland Twitter account has a bunch of fascinating demos of their work so far: https://twitter.com/Dynamicland1


It looks like tig: https://github.com/jonas/tig


Also fails google.com on mobile. http://motherfuckingwebsite.com/ however is a 99/100.



Apparently motherfuckingwebsite would score 100 if they took out the google analytics tracker.


The suggestion says to cache the js file for the analytics tracker, not to remove it.


Good luck setting caching headers on an external resource.


It's hosted by Google, so they control the cache time.


You actually can host the Google Analytics JS file locally, though I'm not sure it's an officially supported configuration.


Do you have any resources on doing this?


it's definitely not a supported config: https://support.google.com/analytics/answer/1032389?hl=en

But you can download it, and host it locally. Just update it periodically. As you can see from the changelog, it only changes every few months: https://developers.google.com/analytics/devguides/collection...

Google actually takes a few days to deploy updates to all of their servers. So a daily script to update it on your server would be fine.


Thanks for this.


You could probably proxy a file through your own server and add any headers you like. But in that case browser cannot use a version of a script cached at other sites.


Why do they only cache it for two hours? Do they want changes to be that quick to take?


Are you being funny? If not, how do you suggest they do that?


There is something to said about the only suggestion there being about the Google's Analytics code.



Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: