admin管理员组

文章数量:1123502

I'm currently working on an app using Google Calendar API.

I'm completely stuck when requesting the Watch content because Google says the URI I've specified for the Channel content is not HTTPS :

2025-01-10 10:49:32 app-1           | 2025-01-10 09:49:32,068 CONFIG [com.goo.api.cli.htt.HttpTransport] (executor-thread-1) -------------- REQUEST  --------------
2025-01-10 10:49:32 app-1           | POST 
2025-01-10 10:49:32 app-1           | Accept-Encoding: gzip
2025-01-10 10:49:32 app-1           | Authorization: <Not Logged>
2025-01-10 10:49:32 app-1           | User-Agent: OptimeApp Google-API-Java-Client/2.0.0 Google-HTTP-Java-Client/1.45.0 (gzip)
2025-01-10 10:49:32 app-1           | x-goog-api-client: gl-java/21.0.5 gdcl/2.0.0 linux/5.15.167
2025-01-10 10:49:32 app-1           | Content-Type: application/json; charset=UTF-8
2025-01-10 10:49:32 app-1           | Content-Encoding: gzip
2025-01-10 10:49:32 app-1           | 
2025-01-10 10:49:32 app-1           | 2025-01-10 09:49:32,068 CONFIG [com.goo.api.cli.htt.HttpTransport] (executor-thread-1) curl -v --compressed -X POST -H 'Accept-Encoding: gzip' -H 'Authorization: <Not Logged>' -H 'User-Agent: OptimeApp Google-API-Java-Client/2.0.0 Google-HTTP-Java-Client/1.45.0 (gzip)' -H 'x-goog-api-client: gl-java/21.0.5 gdcl/2.0.0 linux/5.15.167' -H 'Content-Type: application/json; charset=UTF-8' -H 'Content-Encoding: gzip' -d '@-' -- '' << $$$
2025-01-10 10:49:32 app-1           | 2025-01-10 09:49:32,071 DEBUG [sun.www.pro.htt.HttpURLConnection] (executor-thread-1) sun.www.MessageHeader@614f3e811 pairs: {POST /calendar/v3/calendars/primary/events/watch HTTP/1.1: null}{Accept-Encoding: gzip}{Authorization: Bearer ya29.a0ARW5m75hrpAH13pHKKNu2-0GDitnKSWXNZ3XxVeZjjxAyU-udYVlYYzhXTCStnaRc4L3cnL9S0TInlvpUu-9qOXhLdKaUhc-yonvuxI67yKA9AsqYuXdI-AGKEbfy06vshtztOxx5eUDkuIFAW_92bfMj-tZlP7SJj35aCgYKAV0SARESFQHGX2MiPWyWyY9qojLScOSuKVuk0A0171}{User-Agent: OptimeApp Google-API-Java-Client/2.0.0 Google-HTTP-Java-Client/1.45.0 (gzip)}{x-goog-api-client: gl-java/21.0.5 gdcl/2.0.0 linux/5.15.167}{Content-Type: application/json; charset=UTF-8}{Content-Encoding: gzip}{Host: www.googleapis}{Accept: */*}{Connection: keep-alive}{Transfer-Encoding: chunked}
2025-01-10 10:49:32 app-1           | 2025-01-10 09:49:32,079 CONFIG [com.goo.api.cli.htt.HttpTransport] (executor-thread-1) Total: 110 bytes
2025-01-10 10:49:32 app-1           | 2025-01-10 09:49:32,079 CONFIG [com.goo.api.cli.htt.HttpTransport] (executor-thread-1) {"id":"ChannelID","resourceUri":";,"type":"web_hook"}
2025-01-10 10:49:32 app-1           | 2025-01-10 09:49:32,226 DEBUG [sun.www.pro.htt.HttpURLConnection] (executor-thread-1) sun.www.MessageHeader@6e009cd114 pairs: {null: HTTP/1.1 400 Bad Request}{Vary: Origin}{Vary: X-Origin}{Vary: Referer}{Content-Type: application/json; charset=UTF-8}{Content-Encoding: gzip}{Date: Fri, 10 Jan 2025 09:49:32 GMT}{Server: ESF}{X-XSS-Protection: 0}{X-Frame-Options: SAMEORIGIN}{X-Content-Type-Options: nosniff}{Alt-Svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000}{x-l2-request-path: l2-managed-14}{Transfer-Encoding: chunked}
2025-01-10 10:49:32 app-1           | 2025-01-10 09:49:32,229 CONFIG [com.goo.api.cli.htt.HttpTransport] (executor-thread-1) -------------- RESPONSE --------------
2025-01-10 10:49:32 app-1           | HTTP/1.1 400 Bad Request
2025-01-10 10:49:32 app-1           | X-Frame-Options: SAMEORIGIN
2025-01-10 10:49:32 app-1           | Transfer-Encoding: chunked
2025-01-10 10:49:32 app-1           | Server: ESF
2025-01-10 10:49:32 app-1           | Alt-Svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000
2025-01-10 10:49:32 app-1           | X-Content-Type-Options: nosniff
2025-01-10 10:49:32 app-1           | Content-Encoding: gzip
2025-01-10 10:49:32 app-1           | Vary: Origin
2025-01-10 10:49:32 app-1           | Vary: X-Origin
2025-01-10 10:49:32 app-1           | Vary: Referer
2025-01-10 10:49:32 app-1           | X-XSS-Protection: 0
2025-01-10 10:49:32 app-1           | Date: Fri, 10 Jan 2025 09:49:32 GMT
2025-01-10 10:49:32 app-1           | Content-Type: application/json; charset=UTF-8
2025-01-10 10:49:32 app-1           | x-l2-request-path: l2-managed-14
2025-01-10 10:49:32 app-1           | 
2025-01-10 10:49:32 app-1           | 2025-01-10 09:49:32,243 CONFIG [com.goo.api.cli.htt.HttpTransport] (executor-thread-1) Total: 253 bytes
2025-01-10 10:49:32 app-1           | 2025-01-10 09:49:32,243 CONFIG [com.goo.api.cli.htt.HttpTransport] (executor-thread-1) {
2025-01-10 10:49:32 app-1           |   "error": {
2025-01-10 10:49:32 app-1           |     "errors": [
2025-01-10 10:49:32 app-1           |       {
2025-01-10 10:49:32 app-1           |         "domain": "global",
2025-01-10 10:49:32 app-1           |         "reason": "push.webhookUrlNotHttps",
2025-01-10 10:49:32 app-1           |         "message": "WebHook callback must be HTTPS: "
2025-01-10 10:49:32 app-1           |       }
2025-01-10 10:49:32 app-1           |     ],
2025-01-10 10:49:32 app-1           |     "code": 400,
2025-01-10 10:49:32 app-1           |     "message": "WebHook callback must be HTTPS: "
2025-01-10 10:49:32 app-1           |   }
2025-01-10 10:49:32 app-1           | }
2025-01-10 10:49:32 app-1           | 2025-01-10 09:49:32,248 DEBUG [org.jbo.res.rea.ser.cor.RuntimeExceptionMapper] (executor-thread-1) IOError processing HTTP request to  failed, the client likely terminated the connection.: com.google.api.client.googleapis.json.GoogleJsonResponseException: 400 Bad Request
2025-01-10 10:49:32 app-1           | POST 
2025-01-10 10:49:32 app-1           | {
2025-01-10 10:49:32 app-1           |   "code": 400,
2025-01-10 10:49:32 app-1           |   "errors": [
2025-01-10 10:49:32 app-1           |     {
2025-01-10 10:49:32 app-1           |       "domain": "global",
2025-01-10 10:49:32 app-1           |       "message": "WebHook callback must be HTTPS: ",
2025-01-10 10:49:32 app-1           |       "reason": "push.webhookUrlNotHttps"
2025-01-10 10:49:32 app-1           |     }
2025-01-10 10:49:32 app-1           |   ],
2025-01-10 10:49:32 app-1           |   "message": "WebHook callback must be HTTPS: "
2025-01-10 10:49:32 app-1           | }

When building the Watch object, the URI I Use is HTTPS :

URI uri = new URI(";);
        Calendar.Events.Watch watched = service.events().watch(
                "primary",
                new Channel()
                        .setId("ChannelID")
                        .setType("web_hook")
                        .setResourceUri(uri.toURL().toString())
        );

This URI has been declared in the Google console and is present in the credentials.json file with ID and secrets.

The domain does exist, has a valid, not self-signed certificate :

2025-01-10 10:48:07 app-1           | 2025-01-10 09:48:07,344 DEBUG [jdk.eve.security] (vert.x-internal-blocking-1) X509Certificate: Alg:SHA256withRSA, Serial:473c7bd72d57274b830aaf363f5417fd79c, Subject:CN=lovegiver, Issuer:CN=R10, O=Let's Encrypt, C=US, Key type:RSA, Length:2048, Cert Id:1053261847, Valid from:1/10/25, 8:48 AM, Valid until:4/10/25, 8:48 AM

An endpoint also exists in a controller :

@Path("/notifications")
@POST
public Response watch(Object payload) {
    LOG.debug("WATCH function");
    return Response.ok().build();
}

At this point, I can't understand what I'm missing and I hope someone is able to point the mistake(s) I've made.

Thanx for your time.

本文标签: javaWhy does Google CalendarEventsWatch say my request is not HTTPSStack Overflow