/title>
Please Provide your code
Sub Generate_token()
Dim wb As ThisWorkbook
Set wb = ThisWorkbook
Dim appIdHash As String
appIdHash = wb.Sheets(“Details”).Range(“B5”).Value
Dim AuthCode As String
AuthCode = wb.Sheets(“Details”).Range(“B3”).Value
Data = “{grant_type:authorization_code,appIdHash:” & appIdHash & “,code:” & AuthCode & “}”
URL = “https://api.fyers.in/api/v3/validate-authcode”
Dim obj As Object
Set obj = CreateObject(“MSXML2.ServerXMLHTTP”)
obj.Open “POST”, URL, False
obj.setRequestHeader “Content-type”, “application/json”
obj.send (Data)
Dim Result As String
Result = obj.responseText
Set obj = Nothing
If InStr(1, Result, “error”, vbTextCompare) > 0 Then
Dim q As String
q = InStr(1, Result, “message”, vbTextCompare)
MsgBox Mid(Result, q + 9)
Exit Sub
End If
wb.Sheets(“Details”).Range(“B4”).Value = wb.Sheets(“Details”).Range(“B1”).Value & “:” & Mid(Result, 58, Application.WorksheetFunction.Search(“,”, Mid(Result, 58)) - 2)
MsgBox “Access Token Generated”
End Sub
Hi @ravi.kumar.jdz5thet
Which language is this ?
this is VBA (Vishual Basic)
Bro @ravi.kumar.jdz5thet
Can you try to hit same api in Python or as CURL request
so that we can know is output coming for you.
VBA I don’t have that too much good idea. and Please use Python SDK.
It is much easier than this language.
but at this time i only know VBA. let me simplyfy for you. while passing below details to server i am getting 503 service temporary unavailable error.
Data = “{grant_type:authorization_code,appIdHash:” & appIdHash & “,code:” & AuthCode & “}”
Hi @ravi.kumar.jdz5thet
Please use Python or Node SDK.