I think you should add the following parameter to curl:
--trace-ascii -
The full CURL request would be:
curl 'https://identitytoolkit.googleapis.com/v1/accounts:signInWithCustomToken?key=fgfgkg' -H 'Content-Type: application/json' --data-binary '{"token":"[CUSTOM_TOKEN]","returnSecureToken":true}' --trace-ascii -
After the SSL handshake, this will return all the HTTP headers and the HTTP body of the request that was forged by CURL.
Thus, you can see what is really sent in the body of a POST request. At the bottom of the example below, you can see the JSON object that was sent in the HTTP body of the request. Usually, it does not appear after running a regular curl command.
0000: {"token":"[CUSTOM_TOKEN]","returnSecureToken":true}
the "-" helps to print out to the screen rather than a file. The following example below was trimmed. I didn't paste the full response to make it shorter.
jojo@royan:~$ curl 'https://identitytoolkit.googleapis.com/v1/accounts:signInWithCustomToken?key=fgfgkg' -H 'Content-Type: application/json' --data-binary '{"token":"[CUSTOM_TOKEN]","returnSecureToken":true}' --trace-ascii -
== Info: Trying 142.250.178.170:443...
== Info: Connected to identitytoolkit.googleapis.com (142.250.178.170) port 443 (#0)
== Info: ALPN, offering h2
== Info: ALPN, offering http/1.1
== Info: successfully set certificate verify locations:
== Info: CAfile: /etc/ssl/certs/ca-certificates.crt
== Info: CApath: /etc/ssl/certs
=> Send SSL data, 5 bytes (0x5)
0000: .....
== Info: TLSv1.3 (OUT), TLS handshake, Client hello (1):
=> Send SSL data, 512 bytes (0x200)
0000: .......`7.=..F pJ}.`..<:.YD...\.1_v... .q.q2;c..nt...'T1}.A.P.+.
0040: Px..T...>.......,.0.........+./...$.(.k.#.'.g.....9.....3.....=.
0080: <.5./.....u...#.!...identitytoolkit.googleapis.com..............
00c0: ..........3t.........h2.http/1.1.........1.....*.(..............
0100: ...........................+........-.....3.&.$... .j....C7AO...
0140: .I....G...:....J^?R.............................................
0180: ................................................................
01c0: ................................................................
<= Recv SSL data, 5 bytes (0x5)
0000: ....z
== Info: TLSv1.3 (IN), TLS handshake, Server hello (2):
<= Recv SSL data, 122 bytes (0x7a)
0000: ...v.....H........x.g3..$.mE.3%m...... .q.q2;c..nt...'T1}.A.P.+.
0040: Px..T........3.$... ..n4X.......1....J......1r,.5n}\.+....
<= Recv SSL data, 5 bytes (0x5)
0000: .....
<= Recv SSL data, 5 bytes (0x5)
0000: .....
<= Recv SSL data, 1 bytes (0x1)
0000: .
== Info: TLSv1.3 (IN), TLS handshake, Encrypted Extensions (8):
<= Recv SSL data, 15 bytes (0xf)
0000: .............h2
== Info: TLSv1.3 (IN), TLS handshake, Certificate (11):
<= Recv SSL data, 4396 bytes (0x112c)
0000: ...(...$...0...0............i...f........6V0...*.H........0F1.0.
0040: ..U....US1"0 ..U....Google Trust Services LLC1.0...U....GTS CA 1
0080: C30...211018095256Z..220110095255Z0"1 0...U....upload.video.goog
00c0: le.com0Y0...*.H.=....*.H.=....B...D.1.U.aJ......z.{C.,f....:R*..
0100: .*.R..*........+.sq....`......y......0...0...U...........0...U.%
0140: ..0...+.......0...U.......0.0...U.......a..sP...q..3/_.8...0...U
0180: .#..0....t......=...F..q5.'0j..+........^0\0'..+.....0...http:/
01c0: /ocsp.pki.goog/gts1c301..+.....0..%http://pki.goog/repo/certs/gt
0200: s1c3.der0.....U......0.....upload.video.google.com..*.clients.go
0240: ogle.com..*.docs.google.com..*.drive.google.com..*.gdata.youtube
0280: .com..*.googleapis.com..*.photos.google.com..*.youtube-3rd-party
02c0: .com..upload.google.com..*.upload.google.com..upload.youtube.com
0300: ..*.upload.youtube.com..uploads.stage.gdata.youtube.com..bg-call
0340: -donation.goog..bg-call-donation-alpha.goog..bg-call-donation-ca
0380: nary.goog..bg-call-donation-dev.goog0!..U. ..0.0...g.....0...+..
03c0: ...y...0<..U...50301./.-.+http://crls.pki.goog/gts1c3/QqFxbi9M48
0400: c.crl0.....+.....y............v.F.U.u.. 0...i..}.,At..I.....p.mG
0440: ...|..{......G0E. Qd..V.3QE...O...^.Z.h3OW...q.MAp.!....T..iY>..
0480: ...$.Q.3...n .....Ptv.u.A...."FJ...:.B.^N1.....K.h..b......|..|.
04c0: .....F0D. |.....ye..t..M..t..F.L<......... R&..M...9Y.8It..s..J
0500: ...#[-.....r0...*.H...............-.....*...?..dh ...7/;ZP..x...
0540: .-........T.O...j.d.AL.:.Cj........Q9..n.Pr9..3.....5O......C..7
0580: S.......7.yI{.lS..T..DC..q?..j~R...g3..+e!.......x......b...t.)
05c0: ... x.+a.....<+..e-...!..?e$...Y...^u.x9A......~0.....n......|.3
0600: Kh....M...I....2...............h.....0...0..~..........SYk4....P
0640: f0...*.H........0G1.0...U....US1"0 ..U....Google Trust Services
0680: LLC1.0...U....GTS Root R10...200813000042Z..270930000042Z0F1.0..
06c0: .U....US1"0 ..U....Google Trust Services LLC1.0...U....GTS CA 1C
0700: 30.."0...*.H.............0............b..7.7B.l...e.%...k..m.Z#
0740: .........|....B.^V$.z3....i..t.WLfh.w7US.9.M.4._%w7;...<......C.
0780: ..G..D.c..A..A0H......E.!..B...+eV4.&....}....H|7M?.....u..yW\.W
07c0: n.........%..,...*....c.<PI...._.+Y.....Q..w....O.pI.\m .......
0800: w.-...k....+........'....Q.................0..|0...U...........0
0840: ...U.%..0...+.........+.......0...U.......0.......0...U.......t
0880: ......=...F..q5.'0...U.#..0.....+&q.+H'./Rf,....q>0h..+........\
08c0: 0Z0&..+.....0...http://ocsp.pki.goog/gtsr100..+.....0..$http://p
0900: ki.goog/repo/certs/gtsr1.der04..U...-0+0).'.%.#http://crl.pki.go
0940: og/gtsr1/gtsr1.crl0W..U. .P0N08..+.....y...0*0(..+.........https
0980: ://pki.goog/repository/0...g.....0...g.....0...*.H..............
09c0: }. \.<[email protected]...$..Pq"...n..jo......_.l.......
0a00: b....[.f.........i>z.FI_F.A...Me4...?O.lI..SA..!.....D[*P..M.S6
0a40: .B..T..wS.d8'...X..|9-[..........S$....y.&.a.SR.B..f+?..........
0a80: .q.5($.....-.H.=Y.Q.t..|...[..4..........."....q....s$.7S...?..\
0ac0: .6..;.)...:b;lc...Yq.c'.L....s..*....l2.3...Qq.4...].QX......Y.q
0b00: ..M(..m......F...k.w.....#.........D..u#.4.. ..^...RF.....!pQ...
0b40: ..U.+.3w.KB..w..s.....7?..*f.s.2.2l2....#.[}Mep.+.=...m.2.....c.
0b80: ..]...q^*..."..e:...e.....[.Y.G.-.$:...&....7..o....Q......Q...
0bc0: ...f0..b0..J.......w..l.6...!...X..0...*.H........0W1.0...U....B
0c00: E1.0...U....GlobalSign nv-sa1.0...U....Root CA1.0...U....GlobalS
0c40: ign Root CA0...200619000042Z..280128000042Z0G1.0...U....US1"0 ..
0c80: U....Google Trust Services LLC1.0...U....GTS Root R10.."0...*.H.
0cc0: ............0...............w.;...>...@<....}2..q.......j.....K
0d00: .+...................^..R..#'....c...~..^.h...ZG.M.3.N.....lK...
0d40: ...d)%#....=.`.......H.M..z.....Y........1.......ml....~&.E.=.y.
0d80: .(..&......<h.S..:.+.....z..u....Vd..Oh.=......@..\....5l..P..
0dc0: L... .3.R..2.).%*.H.r..d...........8f..c...x.{\w.v......y.W..&..
0e00: ............U.....K)...2%N*.eD.....I...|..@{.C..l..}...L......K.
0e40: ....E.v..@+.S....;......1..w.o{>...".....2..c.Qr.]....)h3.:f...&
0e80: ...Wex'.^I......!............lH<@.~.Z.V<.....K.9K..?.U.n$..q...
0ec0: .......A...=:..z.7...........80..40...U...........0...U.......0.
0f00: ...0...U........+&q.+H'./Rf,....q>0...U.#..0...`{f.E....P/}..4..
0f40: ..K0`..+........T0R0%..+.....0...http://ocsp.pki.goog/gsr10)..+.
0f80: ....0...http://pki.goog/gsr1/gsr1.crt02..U...+0)0'.%.#.!http://c
0fc0: rl.pki.goog/gsr1/gsr1.crl0;..U. .4020...g.....0...g.....0...+...
1000: ..y....0...+.....y....0...*.H.............4...(...v..1z!..R>..t.
1040: A..=5......\_...|......W.&o[..Fh.7okz...7.%Q..h...I.Z...#...+...
1080: ..Ij.u.......XHW.5.....o..o.......*..Ni..-.h..+s....".7..f.I..U.
10c0: g.2..&.p.=.gm=|.4..2..n.jo.....K.;..7..D.~.l..F.....!.f...Ul.)..
1100: .f[.wIH(....3rS..5.b..$...9..~*A.R.......?..
== Info: TLSv1.3 (IN), TLS handshake, CERT verify (15):
<= Recv SSL data, 79 bytes (0x4f)
0000: ...K...G0E.!........IIE.[......j .......2q.... {F=.0...........)
0040: ..n(.x.......&.
== Info: TLSv1.3 (IN), TLS handshake, Finished (20):
<= Recv SSL data, 52 bytes (0x34)
0000: ...0...Z.....n.Z;...Q.PZ}%-N.Kn.....X....Wt....L...
=> Send SSL data, 5 bytes (0x5)
0000: .....
== Info: TLSv1.3 (OUT), TLS change cipher, Change cipher spec (1):
=> Send SSL data, 1 bytes (0x1)
0000: .
=> Send SSL data, 5 bytes (0x5)
0000: ....E
=> Send SSL data, 1 bytes (0x1)
0000: .
== Info: TLSv1.3 (OUT), TLS handshake, Finished (20):
=> Send SSL data, 52 bytes (0x34)
0000: ...0Io#r...a......i6....d'..K.Br=.....B.k.B.......@.
== Info: SSL connection using TLSv1.3 / TLS_AES_256_GCM_SHA384
== Info: ALPN, server accepted to use h2
== Info: Server certificate:
== Info: subject: CN=upload.video.google.com
== Info: start date: Oct 18 09:52:56 2021 GMT
== Info: expire date: Jan 10 09:52:55 2022 GMT
== Info: subjectAltName: host "identitytoolkit.googleapis.com" matched cert's "*.googleapis.com"
== Info: issuer: C=US; O=Google Trust Services LLC; CN=GTS CA 1C3
== Info: SSL certificate verify ok.
== Info: Using HTTP2, server supports multi-use
== Info: Connection state changed (HTTP/2 confirmed)
== Info: Copying HTTP/2 data in stream buffer to connection buffer after upgrade: len=0
=> Send SSL data, 5 bytes (0x5)
0000: ....)
=> Send SSL data, 1 bytes (0x1)
0000: .
=> Send SSL data, 5 bytes (0x5)
0000: ....,
=> Send SSL data, 1 bytes (0x1)
0000: .
=> Send SSL data, 5 bytes (0x5)
0000: .....
=> Send SSL data, 1 bytes (0x1)
0000: .
== Info: Using Stream ID: 1 (easy handle 0x7fffd59e9560)
=> Send SSL data, 5 bytes (0x5)
0000: ....x
=> Send SSL data, 1 bytes (0x1)
0000: .
=> Send header, 189 bytes (0xbd)
0000: POST /v1/accounts:signInWithCustomToken?key=fgfgkg HTTP/2
003b: Host: identitytoolkit.googleapis.com
0061: user-agent: curl/7.74.0
007a: accept: */*
0087: content-type: application/json
00a7: content-length: 51
00bb:
=> Send SSL data, 5 bytes (0x5)
0000: ....M
=> Send SSL data, 1 bytes (0x1)
0000: .
=> Send data, 51 bytes (0x33)
0000: {"token":"[CUSTOM_TOKEN]","returnSecureToken":true}
== Info: We are completely uploaded and fine