Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google API not recognized by IDE/Maven

I'm using the google API for OAuth token verification server-side. The imports are:

import com.google.api.client.googleapis.auth.oauth2.GoogleIdToken;
import com.google.api.client.googleapis.auth.oauth2.GoogleIdToken.Payload;
import com.google.api.client.googleapis.auth.oauth2.GoogleIdTokenVerifier;

And in my Maven pom.xml dependencies section:

    <dependency>
        <groupId>com.google.oauth-client</groupId>
        <artifactId>google-oauth-client</artifactId>
        <version>1.22.0</version>
    </dependency>

However, I'm getting

Cannot resolve symbol "googleapis"

When I check what packages are in com.google.api.client, I don't see googleapis either. However, these imports were taken straight from the example here

like image 931
frozen Avatar asked Oct 31 '25 22:10

frozen


1 Answers

I figured it out - I just had to add the Google API client as well as the OAuth client. Here's what the dependencies look like in the pom.xml.

<!-- verify oauth tokens -->
        <dependency>
            <groupId>com.google.api-client</groupId>
            <artifactId>google-api-client</artifactId>
            <version>1.20.0</version>
        </dependency>
        <dependency>
            <groupId>com.google.oauth-client</groupId>
            <artifactId>google-oauth-client</artifactId>
            <version>1.22.0</version>
        </dependency>
like image 68
frozen Avatar answered Nov 02 '25 11:11

frozen