Closed subhankarb closed 7 years ago
Cookie is not persisting for https://staging.datapackaged.com. It works for local environment.
fixes #232
@rufuspollock This is working right now. We moved from AWS lambda to heroku.
Previously the cookie was not persisting for staging.datapackaged.com
, as the source domain name was changing in API-Gateway
. The intermediate domain change is not happening now.
So now cookie is storing for domain staging.datapackaged.com
in browser cookie store.
We are unable to alter server templates and control flow based on the users authentication status if the user is visiting via browser (vs e.g. API)
Problem
we use JWT and store them in localstorage. Since these are not sent as part of the request to the server there is no way for the server to know if user is authenticated.
Solution
We can store jwt inside cookie.
Tasks
Update:
For local setup the cookie is setting up perfectly inside the domain http://localhost:5000. But this is not working for our staging environment. The main cause is that, we use lambda which runs behind API-Gateway. So flask by default sets the cookie for API-gateway’s URL that is {hash}.dpr.amazon.{zone}
Solution
Set cookie specifically for staging.datapackaged.com. We can force cookie to be read only for this domain by
resp.set_cookie('jwt', jwt_helper.encode(), domain='staging.datapackaged.com')
Tasks