Google App Script Error while calling Flyers API

I am trying to access API via google sheet apps script.

=====

function getFyToken(fyApiKey, fySecret) {

var fyUrl = “https://api.fyers.in/api/v2/generate-auth-token”;

var fyOptions = {

'method': 'GET',

'headers': {

  'Content-Type': 'application/json',

  'Authorization': fyApiKey + ":" + fySecret

},

'muteHttpExceptions': true,

'payload': JSON.stringify({

  "appId": fyApiKey

})

};

var fyResponse = UrlFetchApp.fetch(fyUrl, fyOptions);

var fyResponseCode = fyResponse.getResponseCode();

var fyResponseData = fyResponse.getContentText();

if (fyResponseCode == 200) {

var fyToken = JSON.parse(fyResponseData);

return fyToken["data"]["accessToken"];

} else {

Logger.log(fyResponseData);

throw new Error("Failed to login to Fyers API. Please check your API key and secret.");

}

}

=====

This function is throwing error

Info

{“s”: “error”, “code”: 500, “message”: “Invalid Request, please provide valid method”}

Would you please let me know what is going wrong and also let me know if any documentation I can refer to for Google App Scripts. Thanks.

https://api.fyers.in/api/v2/generate-auth-token
is not a valid URL
https://api.fyers.in/api/v2/generate-authcode?client_id=SPXXXXE7-100&redirect_uri=https://trade.fyers.in/api-login/redirect-uri/index.html&response_type=code&state=sample_state
opening this url with your data that is clientID redirect url will be redirect to login in case you are already logged in on the browser you will be redirected to your redirect URL you will have your authcode in redirected URL
copy the authcode

make a post request https://api.fyers.in/api/v2/validate-authcode
with payload as follows:
{
“grant_type”:“authorization_code”,
“appIdHash”:"SHA-256 encryption of app_id:app_secret ",
“code”:“authcode here”
}
https://emn178.github.io/online-tools/sha256.html this should help you sha256 encrypt manually to test