• UID13468
  • Fans0
  • Follows0
  • Posts9

Salesforce cometD: 401::Request requires authentication

More Posted time:Dec 9, 2022 0:47 AM
I have to subscribe to cometD Salesforce channel and hence building cometD client in python. I am using the below python library. I have started Salesforce Admin Training, But I can't able to solve this code.

And below is the handshake response I am getting
{'Host': [''], 'Content-Type': ['application/x-www-form-urlencoded'], 'Authorization': ['admin@123Pi6s9Y2QVergfergregpqqY']} message={"channel":"/meta/handshake","id":"1",
            "supportedConnectionTypes":["callback-polling", "long-polling"],
            "version":"1.0","minimumVersion":"1.0"} Headers({'host': [''], 'content-type': ['application/x-www-form-urlencoded'], 'authorization': ['admin@123Pi6s9Y2QVergfergregpqqY']}) {u'successful': False, u'advice': {u'reconnect': u'none'}, u'ext': {u'replay': True, u'sfdc': {u'failureReason': u'401::Request requires authentication'}, u'payload.format': True}, u'error': u'403::Handshake denied', u'id': u'1', u'channel': u'/meta/handshake'}

And I am getting 401::Request requires authentication.

In the Authorization key, I have concatenated password and Access token i.e. admin@123Pi6s9Y2QVergfergregpqqY where admin@123 is the password I use to login to Salesforce.

I have been banging my head since 2 days but not able to figure out why handshake is failing. Any suggestions?