cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Application Key

Amethyst

Application Key

I am seeing weird behavior for the GetKeyID method. It appears that it is a bug. Can someone please confirm this?

myKey = ApplicationKeys[currentUser].GetKeyID();

The currentUser is part of Administrator group. When I execute the service it returns me the App Key. When I look at System -> Application Keys, I do not see the App Key created.

Thanks,

Preeti

Tags (1)
6 REPLIES 6

Re: Application Key

You can't create an app key that way, you should use:

var params = {

  name: "ApplicationKeyName" /* STRING */,

  description: undefined /* STRING */,

  whitelist: undefined /* STRING */,

  user: "UserNameAssignedToThisAppKey" /* USERNAME */,

  tags: undefined /* TAGS */

};

// no return

Resources["EntityServices"].CreateApplicationKey(params);

Re: Application Key

Hi Carles,

Thanks for responding. Yes I am using that to create an app key. But the funny thing is I don't see the App Key created in the UI. However when I use GetKeyID, it is returning me a valid key. It looks like it's reference is still in the database.

Preeti

Re: Application Key

What version of ThingWorx? I just did as Carles suggested, and I see the app key in the UI. I am in 7.2.3

Re: Application Key

Hi,

It maybe a trasactional / Ghost entity problem, if the script which creates the AppKey throws an unhandled exception you can be on the situation you are now. Restart tomcat and check if still you get an AppKey with GetKeyID.

Carles.

Highlighted

Re: Application Key

Hi,

I need one help.

How to get Create Application Key and GetKeyID in Thingworx Java.

I used code like,

For Creating Application Key,

EntityServices es = new EntityServices();

es.createApplicationKey()

For Getting Key ID,

ApplicationKey ak = (ApplicationKey) EntityUtilities.findEntity(userName, ThingworxRelationshipTypes.ApplicationKey);

ak.GetKeyID();

But both are not working. Please help me.

Re: Application Key

Can you debug? What is the createApplicationKey service returning?