As Jose mentioned, a user cannot provide consent during a non-interactive flow (like getAccessTokenSilently). You will need to either use an interactive flow that will show a consent prompt, or skip user consent for first-party apps.
Note: you cannot skip consent on localhost as it is never a verifiable first party app. Although it is possible to set up a workaround to skip the consent page on localhost during development.