Issue with storing permissions in cookie.

I'm unable to store permissions (array of obj) fetched from Login and refresh API. Maybe the size is too big to store. Since I need to restrict in middleware this is a big blocker. Is there any way to do it? (API's are not protected yet)