Service account domain wide delegation is for G Suite accounts only and requires the G Suite admin to authorize the service account client id to have access to the necessary scopes. If you are working with consumer Gmail accounts (@gmail.com address) or you don't have G Suite admin approval then you should use normal OAuth flow like you have working now.
↧
Answer by Jay Lee for Google Gmail API request with service credential returning 400 using Java SDK
↧