Add cookie configuration, change token creation method