Google One Tap throws error with cryptic message - google-identity

After implementing Google One Tap I noticed some JS errors on the client side (these client-side errors are caught in the browser and sent to the backend; I can see them in the backend logs but cannot reproduce the issue in the client side) for which the stack trace looks like this:
Error: A
at Object._.ad (/_/gsi/_/js/k=gsi.gsi.en_US.PmiGgqd91Pc.O/am=CQ/d=1/ct=zgms/rs=AF0KOtWwHiXCDsPbTZybnAb2zlX1YPJDGg/m=gis_client_library:109:138)
at /_/gsi/_/js/k=gsi.gsi.en_US.PmiGgqd91Pc.O/am=CQ/d=1/ct=zgms/rs=AF0KOtWwHiXCDsPbTZybnAb2zlX1YPJDGg/m=gis_client_library:299:24
at He.<anonymous> (/_/gsi/_/js/k=gsi.gsi.en_US.PmiGgqd91Pc.O/am=CQ/d=1/ct=zgms/rs=AF0KOtWwHiXCDsPbTZybnAb2zlX1YPJDGg/m=gis_client_library:241:164)
at uc (/_/gsi/_/js/k=gsi.gsi.en_US.PmiGgqd91Pc.O/am=CQ/d=1/ct=zgms/rs=AF0KOtWwHiXCDsPbTZybnAb2zlX1YPJDGg/m=gis_client_library:87:200)
at He._.l.dispatchEvent (/_/gsi/_/js/k=gsi.gsi.en_US.PmiGgqd91Pc.O/am=CQ/d=1/ct=zgms/rs=AF0KOtWwHiXCDsPbTZybnAb2zlX1YPJDGg/m=gis_client_library:85:347)
at Be (/_/gsi/_/js/k=gsi.gsi.en_US.PmiGgqd91Pc.O/am=CQ/d=1/ct=zgms/rs=AF0KOtWwHiXCDsPbTZybnAb2zlX1YPJDGg/m=gis_client_library:179:210)
at Fe (/_/gsi/_/js/k=gsi.gsi.en_US.PmiGgqd91Pc.O/am=CQ/d=1/ct=zgms/rs=AF0KOtWwHiXCDsPbTZybnAb2zlX1YPJDGg/m=gis_client_library:181:245)
at He._.l.zc (/_/gsi/_/js/k=gsi.gsi.en_US.PmiGgqd91Pc.O/am=CQ/d=1/ct=zgms/rs=AF0KOtWwHiXCDsPbTZybnAb2zlX1YPJDGg/m=gis_client_library:186:212)
at He._.l.Nb (/_/gsi/_/js/k=gsi.gsi.en_US.PmiGgqd91Pc.O/am=CQ/d=1/ct=zgms/rs=AF0KOtWwHiXCDsPbTZybnAb2zlX1YPJDGg/m=gis_client_library:186:187)
The JS code that throws this error is embedded in a <script> tag inside an <iframe> that displays the One Tap login popup and it seems to expect an AJAX response with a specific prefix; the statement that throws the error basically looks like this (minified JS):
if (!a.startsWith(")]}'\n")) throw console.error("malformed JSON response:", a), Error("A");
I checked the network requests and noticed that there is an XHR request that returns the response in this format; the endpoint is https://accounts.google.com/gsi/status (with some extra request parameters) but I cannot find any documentation from google for this endpoint.
Does anyone know would could be the cause of this error?
Thank you

Related

Swashbuckle refuses to show response example for HTTP 500

I'm using Swashbuckle for a web api app in .Net Core 3.1. I want response examples for various response codes. I can get all of them working except HTTP 500. These are the attributes on the a particular method:
[SwaggerRequestExample(typeof(GroupInfoRequest), typeof(GroupInfoRequestExample))]
[SwaggerResponseExample(Status200OK, typeof(GroupInfo200Example))]
[SwaggerResponseExample(Status400BadRequest, typeof(GroupInfo400Example))]
[SwaggerResponseExample(Status403Forbidden, typeof(GroupInfo403Example))]
[SwaggerResponseExample(Status404NotFound, typeof(GroupInfo404Example))]
[SwaggerResponseExample(Status500InternalServerError, typeof(GroupInfo500Example))]
[ProducesResponseType(Status200OK)]
[ProducesResponseType(Status400BadRequest)]
[ProducesResponseType(Status403Forbidden)]
[ProducesResponseType(Status404NotFound)]
[ProducesResponseType(Status500InternalServerError)]
I can get all of them to render except the GroupInfo500Example. The application only returns an HTTP 500 to indicate an internal exception that isn't caught by other exception handlers. It is intended to return a body that contains, among other things, a GUID that can be passed in to our support organization to help them look up the exception in the application logs. I can not get the example to render for any 5xx error. If I change it to another status code, it renders, so it's specifically the 5xx result that doesn't render. I've checked the openapi json produced and it's not produced as part of the generated JSON. Is there a filter in place that keeps 5xx response docs from showing response examples?
Finally figured it out. I was missing part of the 'ProducesResponseType' attribute. It needs to have the return type as well as the HTTP status code. This works:
[ProducesResponseType(typeof(ADServiceOperationMultipleResult<GroupActionRequestForUsers, UserQuery>), Status200OK)]
[ProducesResponseType(typeof(ADServiceOperationMultipleResult<GroupActionRequestForUsers, UserQuery>), Status400BadRequest)]
[ProducesResponseType(typeof(ADServiceOperationMultipleResult<GroupActionRequestForUsers, UserQuery>), Status403Forbidden)]
[ProducesResponseType(typeof(ADServiceOperationMultipleResult<GroupActionRequestForUsers, UserQuery>), Status404NotFound)]
[ProducesResponseType(typeof(ADServiceOperationMultipleResult<GroupActionRequestForUsers, UserQuery>), Status422UnprocessableEntity)]
[ProducesResponseType(typeof(ADServiceOperationMultipleResult<GroupActionRequestForUsers, UserQuery>), Status500InternalServerError)]
Oddly enough, some status codes were including the example without it, but now the examples appear consistently as long as I include the method return type in the attribute.

Saturn API not responding to GET when using acceptJson

The F# Saturn web framework fails on retrieving a value for GET method when acceptJson is a part of pipeline.
Below a sample code that I run to reproduce the issue:
let api = pipeline {
plug acceptJson
set_header "x-pipeline-type" "Api"
}
let apiRouter = router {
not_found_handler (setStatusCode 404 >=> text "Api 404")
pipe_through api
get "/test" (text "Hello world")
}
let appRouter = router {
forward "/api" apiRouter
}
appRouter is then added in the use_router section of the application code.
When I'm sending the request with a header Content-Type:application/json the response is "404 not found". But if I remove plug acceptJson from the api pipeline definition I get a correct response.
How to make Saturn work with the plug acceptJson?
I suspect 3615 is right - this seems similar to a problem I just solved yesterday after beating my head against the wall for a week. A request to my app (just a straight app from "dotnew new Saturn") from my browser was accepted. But a request to the same url from a test method returned a 404. It boiled down to the fact that the test request was missing an "Accept" header. When I added "Accept text/html", it worked. What I deduced from that is that, if the app can't find a content type that will be accepted according to the request, then it will report a 404. Your situation is the same - you're trying to return Json, but the request didn't include an "Accept application/json", so it can't find any page that the request would accept.
Of course, I could be wrong.

Issue with the rails (2.3.11) server(production side)

I am stuck with a very unusual issue. I am trying to call a webservice request from the server (actully an ajax 2 step request from the client side) for which i am getting an xml formatted response which i am parsing using a treeview. The issue is..its working well in development mode on local server but showing error in production with the same codes. When I initiate a request I get a response for the first step in string format but showing error "error loading xmlDoc: xmlDoc is undefined" for the second request which suppose to be initiated directly after the first response.
codes are available here:
https://github.com/domthu/microaquadt/blob/master/app/views/oligo_sequences/edit.html.erb
error is somewhere on the function starting from line 195.
Any help or suggestion would be much appreciated...!!!!

Google docs API: can't download a file, downloading documents works

I'm trying out http requests to download a pdf file from google docs using google document list API and OAuth 1.0. I'm not using any external api for oauth or google docs.
Following the documentation, I obtained download URL for the pdf which works fine when placed in a browser.
According to documentation I should send a request that looks like this:
GET https://doc-04-20-docs.googleusercontent.com/docs/secure/m7an0emtau/WJm12345/YzI2Y2ExYWVm?h=16655626&e=download&gd=true
However, the download URL has something funny going on with the paremeters, it looks like this:
https://doc-00-00-docs.googleusercontent.com/docs/securesc/5ud8e...tMzQ?h=15287211447292764666&amp\;e=download&amp\;gd=true
(in the url '&amp\;' is actually without '\' but I put it here in the post to avoid escaping it as '&').
So what is the case here; do I have 3 parameters h,e,gd or do I have one parameter h with value 15287211447292764666&ae=download&gd=true, or maybe I have the following 3 param-value pairs: h = 15287211447292764666, amp;e = download, amp;gd = true (which I think is the case and it seems like a bug)?
In order to form a proper http request I need to know exectly what are the parameters names and values, however the download URL I have is confusing. Moreover, if the params names are h,amp;e and amp;gd, is the request containing those params valid for obtaining file content (if not it seems like a bug).
I didn't have problems downloading and uploading documents (msword docs) and my scope for downloading a file is correct.
I experimented with different requests a lot. When I treat the 3 parameters (h,e,gd) separetaly I get Unauthorized 401. If I assume that I have only one parameter - h with value 15287211447292764666&ae=download&gd=true I get 500 Internal Server Error (google api states: 'An unexpected error has occurred in the API.','If the problem persists, please post in the forum.').
If I don't put any paremeters at all or I put 3 parameters -h,amp;e,amp;gd, I get 302 Found. I tried following the redirections sending more requests but I still couldn't get the actual pdf content. I also experimented in OAuth Playground and it seems it's not working as it's supposed to neither. Sending get request in OAuth with the download URL responds with 302 Found instead of responding with the PDF content.
What is going on here? How can I obtain the pdf content in a response? Please help.
I have experimented same issue with oAuth2 (error 401).
Solved by inserting the oAuth2 token in request header and not in URL.
I have replaced &access_token=<token> in the URL by setRequestHeader("Authorization", "Bearer <token>" )

Adobe Flex 3 : Fault Event doesnt return XML Feed sent from Server

I am working on a flex application which communicates with a Rails backened.
When i request for some data, It sends back xml feed.
In some cases, if given parameters are not valid, then rails return an error feed with status code = 422 as following
email is wrong
But I dont get this feed in FaultEvent of Flex, How could i read error feed?
Thanks
Are you getting the result in ResultEvent in such cases? I am not sure for what all HTTP error codes FaultEvent will get invoke(I know only it goes for 404 and 500). May be its still going to ResultEvent as a valid result!
You can use HTTPService instead of URLLoader.
Flex HTTP results will not include the actual underlying HTTP response codes. It just doesn't work. (TM)

Resources