Skip to content

Running on localhost

Merlin Nimier-David edited this page Jul 7, 2014 · 4 revisions

Thanks to #51, this process is mostly automated. Just visit / on your localhost in dev mode to obtain a valid request URL.

In order to generate a valid request:

  1. Check your user
  • db.users.find()
  • anyFetchId and anyFetch token must refer to a valid API user (on your target API URL)
  • organization must be the valid ObjectId of your organization in your local MongoDB
  • SFDCId must be data.user.id
  1. Check your organization
  • id must be the id referenced in your user
  • SFDCId must be data.organization.id
  1. Check your data.hash (otherwise, an "invalid master key" error will pop up):
    var hash = data.organization.id + data.user.id + org.masterKey + secureKey;
    hash = crypto.createHash('sha1').update(hash).digest("base64");

Adapted for localhost

{
  "user": {
    "name": "Merlin",
    "email": "merlin@anyfetch.com",
    "id": "00520000003AZxJAAW"
  },
  "sessionId": "00D20000000lnBG!ARcAQLnMkDIado2I8Jh.jj5KGjfaZEFWI9M5UCCmEgXAxpF8ME2HDdLMFIxdVCOD1k2oStQoHecc5QCwnoiuL_Gl7Si2PtXu",
  "salesFetchURL": "https://staging-salesfetch.herokuapp.com",
  "organization": {
    "name": "AnyFetch",
    "id": "00D20000000lnBGEAY"
  },
  "instanceURL": "https://eu0.salesforce.com",
  "hash": "m8TZoX/7L3bu0NUFMvlFrsE/1Pk=",
  "context": {
    "templatedDisplay": "Matthieu Bacconnier",
    "templatedQuery": "Matthieu Bacconnier",
    "recordId": "0032000001DoV22AAF",
    "recordType": "Contact"
  },
  "env": {
    "width": 1084,
    "height": 400,
    "env": "mobile"
  }
}

Taken from SalesForce

{
  "user": {
    "name": "merlin@demo.salesfetch.com",
    "email": "merlin.nimier@gmail.com",
    "id": "00520000003AZxJAAW"
  },
  "sessionId": "00D20000000lnBG!ARcAQNmZzK9oUOVCC_6DzQhwePfzJKDIMt.uAcZoKFrblew_QX3HcJv8RN2x1GPhm5GdxlKejvS0Mo9x5Bf44eyXpXg.TJ88",
  "salesFetchURL": "https://staging-salesfetch.herokuapp.com",
  "organization": {
    "name": "AnyFetch",
    "id": "00D20000000lnBGEAY"
  },
  "instanceURL": "https://eu0.salesforce.com",
  "hash": "m8TZoX/7L3bu0NUFMvlFrsE/1Pk=",
  "context": {
    "templatedDisplay": "Matthieu Bacconnier",
    "templatedQuery": "Matthieu Bacconnier",
    "recordId": "0032000001DoV22AAF",
    "recordType": "Contact"
  },
  "env": {
    "width": 807,
    "height": 400,
    "env": "desktop"
  }
}

Clone this wiki locally