如何导入LocalServerReceiver()?

时间:2016-11-03 16:01:52

标签: java maven google-cloud-platform google-authentication

我有这段代码,但我在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");
}

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

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

1 个答案:

答案 0 :(得分: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>