GDPR might allow for this but other data protection laws might not. In the UK if you want to use an authentication cookie for any other purpose you're required to request permission[0]. Weirdly the guidance also states that consent is also required for persistent login cookies.
[0] https://ico.org.uk/for-organisations/guide-to-pecr/guidance-...