Search code examples
angularparse-serverangular7

How to initialize the SDK of the Parse server with master key [Angular 7]


In order to do a specific request on a Parse server, i need to use the master key.

I tried to initialize it but it seems like i don't do it the right way because i still have this error : ERROR Error: Uncaught (in promise): Error: Cannot use the Master Key, it has not been provided.

Here's my code :

Parse.initialize('myAppId', '', 'myMasterKey');  // appID, js key & master key
(Parse as any).serverURL = 'https://myServerUrl';

Maybe the problem is due to the fact that the js key is empty in the params (my project only use a masterkey). Any help will be welcome...


Solution

  • I did manage to find a solution. i finally did not put the masterkey in the initialize :

    Parse.initialize('myAppId', ''); // appID, js key
    (Parse as any).serverURL = 'https://myServerUrl'; // use your server url
    (Parse as any).masterKey = 'myMasterkey';