delta9
delta9

Reputation: 403

Unique Identifier for each Addon user

So far I have been just playing around with the Addon SDK and making tools for my own use.

I had in mind the idea to possibly try to do something like one of those extensions that adds a profile theme to your Facebook profile, as well as letting others with the extension see your theme when they visit your Facebook profile.

I'm just kind of thinking out what I may do, and what I was wondering is - I know the addon will have a unique ID, but is there anything inherent I can use to identify each unique Addon user? I.e. to tie them to the stored data with their theme information?

If anyone has experience with this - how did you approach it?

Maybe I could set a cookie as the Addon that lasts a year or something, and then keep resetting it each time the browser is opened, and hope for the best?

Upvotes: 2

Views: 354

Answers (1)

Wladimir Palant
Wladimir Palant

Reputation: 57691

Since you are using Add-on SDK you are probably best off by using simple-storage. You can also use makeUuid() function in the xpcom package to generate a guaranteed unique identifier. Something like this:

var ss = require("simple-storage");
if (!("UserID" in ss))
{
  // We were just installed, generate user ID
  var xpcom = require("xpcom");
  ss.UserID = xpcom.makeUuid()
}
console.log("User ID: " + ss.UserID);

Please make sure that you have a privacy policy where you explain that you generate a user identifier and what you use it for.

Upvotes: 4

Related Questions