我已经在 Map 册上创建了一个Stctch应用程序,但我坚持认证工作 . 我已启用匿名身份验证并尝试使用此方法登录,复制示例的针脚代码 .

@Injectable({ providedIn: 'root' })
export class WordService {
client: any;
constructor(private http: HttpClient) {
   const clientPromise = stitch.StitchClientFactory.create('myAppId');
   clientPromise.then(client => {
      const db = client.service('mongodb', 'mongodb-atlas').db('my-db');
      client.login().then(() =>
         db.collection('words').find({ owner_id: client.authedId() 
    }).limit(100).execute()).then(docs => {
        console.log("Found docs", docs)
        console.log("[MongoDB Stitch] Connected to Stitch")
    }).catch(err => {
      console.error(err)
    });
  });
}

我得到的错误:

main.js:404错误:连接到MongoDB服务集群时出错:无法使用“SCRAM-SHA-1”机制进行身份验证:(AtlasError)bad auth身份验证失败 .