如何导入LocalServerReceiver()?

Ela*_*nda 1 java google-authentication maven google-cloud-platform

我有这个代码,但我在maven-repository中找不到

要导入的正确库.有谁知道它是谁?

import com.google.api.client.extensions.jetty.auth.oauth2.LocalServerReceiver;


/** Authorizes the installed application to access user's protected data. */
private static Credential authorize() throws IOException {
    dataStoreFactory = new FileDataStoreFactory(DATA_STORE_DIR);
    // set up authorization code flow
    GoogleAuthorizationCodeFlow flow = new GoogleAuthorizationCodeFlow.Builder(
            TRANSPORT, JSON_FACTORY, clientSecrets, SCOPES).setDataStoreFactory(
            dataStoreFactory).build();
    // authorize
    return new AuthorizationCodeInstalledApp(flow, new LocalServerReceiver()).authorize("user");
}
Run Code Online (Sandbox Code Playgroud)

我找不到com.google.api.client.extensions.jetty

https://mvnrepository.com/search?q=com.google.api.client.extensions.jetty

jmr*_*ruc 5

您可以访问:https://mvnrepository.com/artifact/com.google.oauth-client/google-oauth-client-jetty/1.22.0

<dependency>
    <groupId>com.google.oauth-client</groupId>
    <artifactId>google-oauth-client-jetty</artifactId>
    <version>1.22.0</version>
</dependency>
Run Code Online (Sandbox Code Playgroud)