Complete
over 2 years ago

WERETECH-8848

Cannot Reproduce

makeWebRequest: bad request on some devices

Some devices got a bad request on next makeWebRequest: 

Communications.makeWebRequest("https://www.googleapis.com/calendar/v3/calendars/[email protected]/events",
{timeMin=>2020-4-30T12:19:00+02:00, timeMax=>2020-5-1T12:19:00+02:00},
{:method=>Communications.HTTP_REQUEST_METHOD_GET, :headers=>{ "Authorization"=>"Bearer "+"ya29…valid-oauth-token…
OpxLk" }}, method(:onEvents));

  1. in simulator it works fine
  2. in majority of devices it works fine
  3. the oauth token is valid: the login was confirmed and another request was successful
  4. Error 400: Bad Request on some devices: e.g.  iPhone X, iOS 13.4.1, Garmin Connect: 4.30
    1. same parameters work on https://developers.google.com/calendar/v3/reference/events/list
    2. the user even tested it works for his account in the simulator, but not in the device through his phone

Testing: 

  • by previous testing I realised in another request the device translated "showDeleted"=>false  to "showDeleted"=>0 and that was not accepted by Google on some devices while worked fine on most of them. So I fixed that one. 
  • but in the request above all the parameters are strings, so I don't see anything that can go wrong. 
  • from debugging couple of devices, I am almost sure the problem is caused inside the makeWebRequest. But I don't know what can go wrong. The debug data just looks good yet it replies with the Bad Request. 

What can be wrong there? 

The only idea I have is that it is something phone/app specific inside the makeWebRequest itself. 

Source, app.

Parents
  • Not sure it will help but I'm the user with the issue described by . I'm currently working on another application using Communications.makeOAuthRequest and Communications.makeWebRequest to connect to Spotify Web API.

    From simulator, all works fine, I'm able to realize OAuth flow and execute simple POST and PUT commands to manage playback.

    Using my device (Fenix 6 Sapphire SW 9.0, iPhone X iOS 13.4.1, Garmin Connect 4.30) OAuth flow works fine. Communications.makeWebRequest present the same issue with a result -400 when API return 204.

    Here are logs of my last test:

    POST https://api.spotify.com/v1/me/player/next HTTP/1.1
    Host: api.spotify.com
    Content-Type: application/x-www-form-urlencoded
    Cookie: sp_dc=AQCOwo2Fd1mAJ3kzdA3bgR1qVyRJd5BNT0M6lDDxxCG6vwL9aKdjdsw1rV5u4FDoCbgX0BIgqutDnpymabTwk2E5SddIkygpD7Y6_f7QqL4; sp_key=585790ad-48b5-4156-883c-08a6695ecca3; _ga=GA1.2.961039430.1589039197; _gid=GA1.2.678202210.1589039197
    User-Agent: ConnectMobile/23 CFNetwork/1125.2 Darwin/19.4.0
    Connection: keep-alive
    Accept: */*
    Accept-Language: fr-fr
    Content-Length: 2
    Accept-Encoding: gzip, deflate, br
    Authorization: Bearer BQAcy...STgg
    
    {}
    
    
    HTTP/1.1 204 No Content
    cache-control: private, max-age=0
    x-robots-tag: noindex, nofollow
    access-control-allow-origin: *
    access-control-allow-headers: Accept, App-Platform, Authorization, Content-Type, Origin, Retry-After, Spotify-App-Version, X-Cloud-Trace-Context
    access-control-allow-methods: GET, POST, OPTIONS, PUT, DELETE, PATCH
    access-control-allow-credentials: true
    access-control-max-age: 604800
    strict-transport-security: max-age=31536000
    x-content-type-options: nosniff
    date: Sat, 09 May 2020 16:01:39 GMT
    server: envoy
    Via: HTTP/2 edgeproxy, 1.1 google
    Alt-Svc: clear

    In addition, I also tried to remove and reinstall Garmin Connect Mobile but it has not any effect.

    I also have the same issue with a third experimental application connecting to a local web resource.

    Many thanks if you can help me to go through that issue.

Comment
  • Not sure it will help but I'm the user with the issue described by . I'm currently working on another application using Communications.makeOAuthRequest and Communications.makeWebRequest to connect to Spotify Web API.

    From simulator, all works fine, I'm able to realize OAuth flow and execute simple POST and PUT commands to manage playback.

    Using my device (Fenix 6 Sapphire SW 9.0, iPhone X iOS 13.4.1, Garmin Connect 4.30) OAuth flow works fine. Communications.makeWebRequest present the same issue with a result -400 when API return 204.

    Here are logs of my last test:

    POST https://api.spotify.com/v1/me/player/next HTTP/1.1
    Host: api.spotify.com
    Content-Type: application/x-www-form-urlencoded
    Cookie: sp_dc=AQCOwo2Fd1mAJ3kzdA3bgR1qVyRJd5BNT0M6lDDxxCG6vwL9aKdjdsw1rV5u4FDoCbgX0BIgqutDnpymabTwk2E5SddIkygpD7Y6_f7QqL4; sp_key=585790ad-48b5-4156-883c-08a6695ecca3; _ga=GA1.2.961039430.1589039197; _gid=GA1.2.678202210.1589039197
    User-Agent: ConnectMobile/23 CFNetwork/1125.2 Darwin/19.4.0
    Connection: keep-alive
    Accept: */*
    Accept-Language: fr-fr
    Content-Length: 2
    Accept-Encoding: gzip, deflate, br
    Authorization: Bearer BQAcy...STgg
    
    {}
    
    
    HTTP/1.1 204 No Content
    cache-control: private, max-age=0
    x-robots-tag: noindex, nofollow
    access-control-allow-origin: *
    access-control-allow-headers: Accept, App-Platform, Authorization, Content-Type, Origin, Retry-After, Spotify-App-Version, X-Cloud-Trace-Context
    access-control-allow-methods: GET, POST, OPTIONS, PUT, DELETE, PATCH
    access-control-allow-credentials: true
    access-control-max-age: 604800
    strict-transport-security: max-age=31536000
    x-content-type-options: nosniff
    date: Sat, 09 May 2020 16:01:39 GMT
    server: envoy
    Via: HTTP/2 edgeproxy, 1.1 google
    Alt-Svc: clear

    In addition, I also tried to remove and reinstall Garmin Connect Mobile but it has not any effect.

    I also have the same issue with a third experimental application connecting to a local web resource.

    Many thanks if you can help me to go through that issue.

Children
No Data