Skip to content

Instantly share code, notes, and snippets.

@mitchellrj
Created July 4, 2013 08:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mitchellrj/50ae1ed0c0dc544a02ca to your computer and use it in GitHub Desktop.
Save mitchellrj/50ae1ed0c0dc544a02ca to your computer and use it in GitHub Desktop.
Restricted LinkedIn userspace.js
(function () {
var r = ("true" === "false"),
a = ("false" === "false"),
h = ["*.linkedin.com", "*.custhelp.com"],
e = ("false" === "true");
var p = "${SCOPE_NAME}";
var s = ("SCOPE_VALID" === "SCOPE_INVALID"),
n = ("SCOPE_VALID" === "SCOPE_NOT_AUTHORIZED"),
d = ("SCOPE_VALID" === "SCOPE_DISABLED");
if (e) {
throw new Error("An error occurred.");
} else if (!a) {
throw new Error("API Key is invalid");
} else if (s) {
throw new Error("Scope parameter is invalid: " + p);
} else if (n) {
throw new Error("Scope parameter is not authorized: " + p);
} else if (d) {
throw new Error("Scope parameter is disabled: " + p);
} else if (h.length == 0) {
throw new Error("You must specify a valid JavaScript API Domain as part of this key's configuration.");
} else if (!r) {
throw new Error("JavaScript API Domain is restricted to " + h.join(", "));
} else {
throw new Error("Unknown Error");
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment