This question is locked. New answers and comments are not allowed.
I'm trying to add DataItems using only my Master Key (no username / password), but I get the following error: "CREATE access on type 'MyType' denied for anonymous user".
I got the following from the EverLive portal regarding the Master Key: "The Master Key can be used to bypass application security and grant you access to manage your Everlive app from a service similar to the Everlive portal."
I've set the permissions on my type to "Read-Only" because I'll only be creating and updating them from a backend application.
I got the following from the EverLive portal regarding the Master Key: "The Master Key can be used to bypass application security and grant you access to manage your Everlive app from a service similar to the Everlive portal."
I've set the permissions on my type to "Read-Only" because I'll only be creating and updating them from a backend application.
4 Answers, 1 is accepted
0
Hello Mischa,
Can you please share the code that makes the connection to Everlive and how you supply the master key? Of course, you should replace the actual master key with ### or something, so that it is not visible to everyone.
On a side note, you concept is correct - using master key with read-only permissions on the content type. This ensures that users of your Everlive app can only read data from the content type, but only you can insert, update or delete items.
Regards,
Lyubomir Dokov
Telerik
Can you please share the code that makes the connection to Everlive and how you supply the master key? Of course, you should replace the actual master key with ### or something, so that it is not visible to everyone.
On a side note, you concept is correct - using master key with read-only permissions on the content type. This ensures that users of your Everlive app can only read data from the content type, but only you can insert, update or delete items.
Regards,
Lyubomir Dokov
Telerik
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.
0
Mischa
Top achievements
Rank 1
answered on 25 Oct 2013, 01:21 PM
Hi Lyubomir,
Here's my code:
EverliveAppSettings eAppSettings = new EverliveAppSettings()
{
ApiKey = "MyApp_ApiKey"
};
eApp = new EverliveApp(eAppSettings);
eApp.WorkWith().Authentication().Login("MyApp_MasterKey");
eApp.WorkWith().Data<MyClass>().Create(myClass).ExecuteSync();
Here's my code:
EverliveAppSettings eAppSettings = new EverliveAppSettings()
{
ApiKey = "MyApp_ApiKey"
};
eApp = new EverliveApp(eAppSettings);
eApp.WorkWith().Authentication().Login("MyApp_MasterKey");
eApp.WorkWith().Data<MyClass>().Create(myClass).ExecuteSync();
0
Accepted
Hello Mischa,
I can see the problem now. It is in the following line:
eApp.WorkWith().Authentication().Login("MyApp_MasterKey");
You are not actually executing this login request. The login request is just like any other Everlive service request - it is asynchronous and you must either await it or execute it synchronously. This means that you should have something like this:
eApp.WorkWith().Authentication().Login("MyApp_MasterKey");.ExecuteSync();
After this line completes, all following requests to Everlive will be made using masterkey authentication.
Regards,
Lyubomir Dokov
Telerik
I can see the problem now. It is in the following line:
eApp.WorkWith().Authentication().Login("MyApp_MasterKey");
You are not actually executing this login request. The login request is just like any other Everlive service request - it is asynchronous and you must either await it or execute it synchronously. This means that you should have something like this:
eApp.WorkWith().Authentication().Login("MyApp_MasterKey");.ExecuteSync();
After this line completes, all following requests to Everlive will be made using masterkey authentication.
Regards,
Lyubomir Dokov
Telerik
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.
0
Mischa
Top achievements
Rank 1
answered on 25 Oct 2013, 02:14 PM
Got it! It's now working, here's the code:
EverliveAppSettings eAppSettings = new EverliveAppSettings()
{
ApiKey = "MyApp_ApiKey"
};
eApp = new EverliveApp(eAppSettings);
eApp.WorkWith().Authentication().Login("MyApp_MasterKey").ExecuteSync();
eApp.WorkWith().Data<MyClass>().Create(myClass).ExecuteSync();
EverliveAppSettings eAppSettings = new EverliveAppSettings()
{
ApiKey = "MyApp_ApiKey"
};
eApp = new EverliveApp(eAppSettings);
eApp.WorkWith().Authentication().Login("MyApp_MasterKey").ExecuteSync();
eApp.WorkWith().Data<MyClass>().Create(myClass).ExecuteSync();