Razzle: An example with razzle with auth

Created on 15 Oct 2017  ·  4Comments  ·  Source: jaredpalmer/razzle

I'm struggling to find the best method to store and load a cookie the "razzle" way. Curious to hear how others tackle this and potentially if we can include this as an example?

stale

Most helpful comment

Yeah I can add an example. You put your token in a cookie 🍪 and that way it’s available isomorphically. If you’re using cookie parser middleware it will be in req.headers.cookie on the server. You should get the token and make it available to whatever http client you are using to fetch data. I usually have a makeFetch(req?: express.Request) that returns a wrapper of fetch() with default auth headers that gets called on both the client and server.

All 4 comments

Yeah I can add an example. You put your token in a cookie 🍪 and that way it’s available isomorphically. If you’re using cookie parser middleware it will be in req.headers.cookie on the server. You should get the token and make it available to whatever http client you are using to fetch data. I usually have a makeFetch(req?: express.Request) that returns a wrapper of fetch() with default auth headers that gets called on both the client and server.

Hola! So here's the deal, between open source and my day job and life and what not, I have a lot to manage, so I use a GitHub bot to automate a few things here and there. This particular GitHub bot is going to mark this as stale because it has not had recent activity for a while. It will be closed if no further activity occurs in a few days. Do not take this personally--seriously--this is a completely automated action. If this is a mistake, just make a comment, DM me, send a carrier pidgeon, or a smoke signal.

ProBot automatically closed this due to inactivity. Holler if this is a mistake, and we'll re-open it.

I looked in the examples section and could not find an auth example. Am I missing it somewhere? Thank you for anyone for pointing out where the auth example is. Thanks!

Tim

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jcblw picture jcblw  ·  4Comments

knipferrc picture knipferrc  ·  5Comments

ewolfe picture ewolfe  ·  4Comments

corydeppen picture corydeppen  ·  3Comments

JacopKane picture JacopKane  ·  3Comments