Dan6erbond / sk-auth

Authentication library for use with SvelteKit featuring built-in OAuth providers and zero restriction customization!
MIT License
577 stars 70 forks source link

Add possibility to control cookie settings #36

Open machak opened 3 years ago

machak commented 3 years ago

Unless I am missing something, there is no way to control cookie at the moment. I don't care so much about the cookie name, but I would like to have a control about cookie value/time/path and other options. (and a big thanks for providing the library ;-) )

Dan6erbond commented 3 years ago

Thank you for creating this issue! Those are all good points! I am currently working on many ideas to improve the flexibility of this library, and how cookies are handled is at the top of the list. I think I will avoid any cookie() callbacks that let you define those properties, but instead would like to make it easier to inherit from the base SvelteKitAuth class and just override the specific methods to get the functionality you need.

This goes right into other issues I'm working on at the moment (sparingly, as I'm busy and this project kind of sprung up at an unexpected time for me during the work on another SvelteKit app) - as I would like to allow providers to return metadata that define the routes they can handle, with methods and all, so I see something similar being the case for this, with functions that define the metadata for cookies (such as path, time, and other flags) as well as a method that generates the JWT and a method to return Set-Cookie headers which can be overriden.