Navigation

    SmartAPI Forum
    • Register
    • Login
    • Search
    • Categories
    • Popular
    • Groups
    • FAQs
    • API Docs

    Error Code: AG8001 after providing every inputs correctly

    Bugs
    0
    6
    15
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • B
      bharatsheoran last edited by

      I am trying to access the LiveMarketData API, but I am not able to do so because everytime I made the request if give me error code: AG8001 in response,

      {data: "",
      errorCode: "AG8001"
      message: "Invalid Token"
      success: false

      My AuthToken is correct, api key is correct and pin is also correct.
      Client Id: B59199567

      Please look into the matter why I am getting invalid token while fetching live market data api.

      Request Format:
      let data = JSON.stringify({
      "mode": "LTP",
      "exchangeTokens": {
      "NSE": ["14366"]
      }
      });
      let config = {
      method: 'post',
      url: 'https://apiconnect.angelone.in/rest/secure/angelbroking/market/v1/quote/',

          headers: {
              'Authorization': `${req.headers['authorization']}`,
              'Content-Type': 'application/json',
              'Accept': 'application/json',
              'X-UserType': 'USER',
              'X-SourceID': 'WEB',
              'X-ClientLocalIP': process.env.LOCALIP,
              'X-ClientPublicIP': process.env.PUBLICIP,
              'X-MACAddress': process.env.MACADDRESS,
              'X-PrivateKey': process.env.ANGLEONEAPIKEY
          },
          data: data
      };
      
      1 Reply Last reply Reply Quote 0
      • A
        admin last edited by

        @bharatsheoran you need to add bearer token in the authorization

        1 Reply Last reply Reply Quote 0
        • B
          bharatsheoran last edited by

          @admin I have added Bearer in frontend.

          1 Reply Last reply Reply Quote 0
          • B
            bharatsheoran last edited by

            @admin I am not able to send my frontend code, I don't know the page is not responding whenever I add code to it

            1 Reply Last reply Reply Quote 0
            • A
              admin last edited by

              @bharatsheoran if that's the case, there would be an issue with your code.

              Live market API is working fine, you can try using postman to check.

              62855392-f5f8-4b38-825f-0abec4847f59-image.png

              You can take the help of someone from the forum for your code.

              1 Reply Last reply Reply Quote 0
              • B
                bharatsheoran last edited by

                Yes, I got a syntax error in my frontend which is now resolved. I am very Thankful for your time.

                Can you help me in WebSocket as I am able to connect with websocket and also getting the heartbeats but I am not able to subscribe any stock and not getting any response when I am sending the data through websocket. The data is this,

                {
                "correlationID": "abcde12345",
                "action": 1,
                "params": {
                "mode": 1,
                "tokenList": [
                {
                "exchangeType": 1,
                "tokens": [
                "10626",
                "5290"
                ]
                },
                {
                "exchangeType": 5,
                "tokens": [
                "234230",
                "234235",
                "234219"
                ]
                }
                ]
                }
                }

                And I am getting a binary data only and nothing else from websocket.

                Can you help me how to use websocket!

                1 Reply Last reply Reply Quote 0
                • First post
                  Last post