Solucionado (ver solução)
Solucionado
(ver solução)
1
resposta

Erro ao fazer a consulta com a API do Google Books

Ola, fui fazer o exercicio do curso porem ao eu ativar a API do google books e criar minha key, ao fazer chamado no Java aparece o seguinte erro:

You are receiving this error either because your input OAuth2 scope name is invalid or it refers to a newer scope that is outside the domain of this legacy API.

This API was built at a time when the scope name format was not yet standardized. This is no longer the case and all valid scope names (both old and new) are catalogued at https://developers.google.com/identity/protocols/oauth2/scopes. Use that webpage to lookup (manually) the scope name associated with the API you are trying to call and use it to craft your OAuth2 request.

Isso e no console logo apos rodar meu codigo:

package br.com.alura.screenmatch.desafio;

import java.io.IOException;
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

public class PesquisaLivro {
    public static void main(String[] args) throws IOException, InterruptedException {

        String livro = "teste";
        HttpClient client = HttpClient.newHttpClient();
        HttpRequest request = HttpRequest.newBuilder()
                .uri(URI.create("https://www.googleapis.com/auth/books/v1/volumes?q=" + livro + "&key=MInhaKey"))
                .build();
        HttpResponse<String> response = client
                .send(request, HttpResponse.BodyHandlers.ofString());
        System.out.println(response.body());
    }
}

O que eu preciso fazer? realmente nao entendi muito bem.

OBS: ali na KEY eu coloquei a key que o google ofereceu para a API

1 resposta
solução!

Descobri o erro foi o auth que estava no meio da URL da API do google kk