Invalid Hostname bad request
Followed this document(https://learn.microsoft.com/en-us/graph/auth-v2-user?tabs=curl) to generate auth token and refresh token but encountering this error
curl --location --request POST 'https://login.microsoftonline.com/common/oauth2/v2.0/token' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'client_id=5ebdb502-6d2a-48fc-874e-eaa1fe0ac03a' \
--data-urlencode 'grant_type=authorization_code' \
--data-urlencode 'scope=Mail.Send User.Read' \
--data-urlencode 'code=M.C536_BAY.2.U.394ee29a-2212-2c70-dd27-4500957c59c6' \
--data-urlencode 'redirect_uri=https://oauth.pstmn.io/v1/browser-callback' \
--data-urlencode 'client_secret=UDB8Q~rybsM1NqRO3oc5q26r7-S~0YP~gNxWIcnV'
ERROR:
curl --location --request POST 'https://login.microsoftonline.com/common/oauth2/v2.0/token' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'client_id=5ebdb502-6d2a-48fc-874e-eaa1fe0ac03a' \
--data-urlencode 'grant_type=authorization_code' \
--data-urlencode 'scope=Mail.Send User.Read' \
--data-urlencode 'code=M.C536_BAY.2.U.394ee29a-2212-2c70-dd27-4500957c59c6' \
--data-urlencode 'redirect_uri=https://oauth.pstmn.io/v1/browser-callback' \
--data-urlencode 'client_secret=UDB8Q~rybsM1NqRO3oc5q26r7-S~0YP~gNxWIcnV'
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
<HTML>
<HEAD>
<TITLE>Bad Request</TITLE>
<META HTTP-EQUIV="Content-Type" Content="text/html; charset=us-ascii">
</HEAD>
<BODY>
<h2>Bad Request - Invalid Hostname</h2>
<hr>
<p>HTTP Error 400. The request hostname is invalid.</p>
</BODY>
</HTML>