After logging in my url changes to /login/ and cookie gets set. After setting cookie need to redirect the page on home page (url : /homePage/) other than /login/.
How to set same cookie in all pages?
After logging in my url changes to /login/ and cookie gets set. After setting cookie need to redirect the page on home page (url : /homePage/) other than /login/.
How to set same cookie in all pages?
You can use the inbuilt
CookieJar
library to manage a store of cookies (see this answer for some pointers), but it's probably easier to use something like Gorilla Sessions from the Gorilla Web Toolkit.There is also some GAE specific setup (from http://www.gorillatoolkit.org/):
The last line of that example is specific to the
mux
package. You would replace it with:A quick example:
Define your cookie store:
And then, in your page handlers you just load the cookie, set any options you like and re-save it:
Hope that helps.