Parse JS SDK:无法使用主密钥,尚未提供 [英] Parse JS SDK: Cannot use the Master Key, it has not been provided
本文介绍了Parse JS SDK:无法使用主密钥,尚未提供的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要在我的angular2应用程序中使用masterKey,但是我无法将其传递给initialize
函数,而且我无法用Google查明原因.
从package.json
:"parse": "~1.9.2"
.
I need to use masterKey inside my angular2 app, but I can't pass it to initialize
function and I can't google out why.
From package.json
: "parse": "~1.9.2"
.
初始化:
import {Parse} from '~/node_modules/parse/dist/parse';
@Injectable()
export class TFCloudService {
constructor() {
this.parse = Parse;
Parse.initialize(appConfig.parse.appId, null, appConfig.parse.masterKey);
Parse.serverURL = appConfig.parse.clientServerUrl;
Parse.liveQueryServerURL = appConfig.parse.liveQueryServerURL;
}
}
错误源:
this.edittedUser.save(null, {useMasterKey: true})
.then((user) => {
console.log(user);
});
错误文字:
Error: Cannot use the Master Key, it has not been provided.
appConfig.parse.masterKey
正常工作,我也用硬编码键检查了该行,但是得到了相同的结果.
appConfig.parse.masterKey
works fine, I checked that line with hard-coded key too, but got the same result.
推荐答案
实际上猜出了传递该密钥的正确方法:
Actually guessed the right way to pass that key:
Parse.initialize(appConfig.parse.appId);
Parse.masterKey = appConfig.parse.masterKey;
这篇关于Parse JS SDK:无法使用主密钥,尚未提供的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文