Apple Authentication 502 Bad Gateway

Hello,

When I build the ios and put the apple id and password, it shows 502 Bad Gateway error.

Then the apple id is created on Japan,
I run the script on USA server.

But I login successfully on the browser.
Why does this issue happen?

Kind Regards