Skip to content

Gmail API Java Quickstart Exception checkArgument(Preconditions.java:131) #220

@ptro46

Description

@ptro46

Summary

I follow this quickstart https://developers.google.com/gmail/api/quickstart/java
I create a project and enable the Gmail API
https://developers.google.com/workspace/guides/create-project
I create credentials
https://developers.google.com/workspace/guides/create-credentials
API Key, OAuth client ID, and a Service Account, I download the json file while I create the key in service Account, and I put this file as credentials.json in src/main/resources

Sample Name

Gmail Java Quickstart

Expected Behavior

no exception

Actual Behavior

$ gradle run

Task :run FAILED
Exception in thread "main" java.lang.IllegalArgumentException
at com.google.common.base.Preconditions.checkArgument(Preconditions.java:131)
at com.google.api.client.util.Preconditions.checkArgument(Preconditions.java:35)
at com.google.api.client.googleapis.auth.oauth2.GoogleClientSecrets.getDetails(GoogleClientSecrets.java:80)
at com.google.api.client.googleapis.auth.oauth2.GoogleAuthorizationCodeFlow$Builder.(GoogleAuthorizationCodeFlow.java:211)
at GmailQuickstart.getCredentials(GmailQuickstart.java:55)
at GmailQuickstart.main(GmailQuickstart.java:69)

Specifications

  • Java version (java -version)
    $ java -version
    java version "18.0.1.1" 2022-04-22
    Java(TM) SE Runtime Environment (build 18.0.1.1+2-6)
    Java HotSpot(TM) 64-Bit Server VM (build 18.0.1.1+2-6, mixed mode, sharing)

  • OS Mac

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions