我需要在我的 angular2 应用程序中使用 masterKey,但我无法将其传递给initialize
功能,我无法用谷歌搜索出原因。
从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
工作正常,我也用硬编码密钥检查了该行,但得到了相同的结果。
实际上猜到了传递该密钥的正确方法:
Parse.initialize(appConfig.parse.appId);
Parse.masterKey = appConfig.parse.masterKey;
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)