Parse JS SDK:无法使用主密钥,尚未提供

2024-04-29

我需要在我的 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(使用前将#替换为@)

Parse JS SDK:无法使用主密钥,尚未提供 的相关文章

随机推荐