Prometheus remotewrite auth in helm chart

Hi,
I am trying to set my prometheus in remote write to grafana cloud. But somehow I am facing authentication issues.

ts=2024-07-18T17:36:30.457Z caller=dedupe.go:112 component=remote level=error remote_name=42fc5c url=https://abc.grafana.net/api/prom/push msg=“non-recoverable error” count=2000 exemplarCount=0 err=“server returned HTTP status 401 Unauthorized: {"status":"error","error":"authentication error: invalid authentication credentials"}”

Below is my configuration:

remoteWrite:
    - url: https://abc.grafana.net/api/prom/push
      basicAuth:
        username:
          key: username
          name: promsecret
        password:
          key: password
          name: promsecret
apiVersion: v1
kind: Secret
metadata:
  name: promsecret
  type: Opaque
data:
    username: <base64 of user in grafanacloud's prometheus datasource>
    password: <base64 of generated token under cloud access policy>

I am unable to get what is wrong over here.