Add option to provide a custom getToken function