如何通过 mongodb atlas 中的“local-userpass”进行身份验证?

问题描述 投票:0回答:1

我正在参考mongodb官方文档来跟踪待办事项应用程序示例。 但是,错误“E/LoginEvent:无法注册:不支持通过‘本地用户密码’进行[服务] [未知(-1)]身份验证。” 未保存在图集中。


这就是为什么它卡在此处的链接中。 Android 与 Kotlin 教程

这是该应用程序的文档。 模板应用程序

抱歉没有解释。这是我第一次学习mongodb,所以我不知道该怎么说。

我想正常学习这个教程,我该怎么办?

问chatgpt,一直看官方文档也看不懂…… Chatgpt 说在最新版本的 mongodb 中不允许这种行为,但我不太清楚。

android mongodb kotlin realm mongodb-atlas
1个回答
0
投票

创建用户也不适合我。您可以在 Atlas 中创建一个用户,如果您使用的是网络,那么它位于 App Services / App Users / Add New User 下

您可能需要进行一些配置更改来设置用户名/密码。

或者,如果您想玩一玩,您可以允许匿名登录。

class TemplateApp: Application() {

override fun onCreate() {
    super.onCreate()
    app = App.create(
        AppConfiguration.Builder(getString(R.string.realm_app_id))
            .baseUrl(getString(R.string.realm_base_url))
            .build()
    )
    runBlocking {
        val anonymousCredentials = Credentials.anonymous()
        val user = app.login(anonymousCredentials)
    }
    Log.v(TAG(), "Initialized the App configuration for: ${app.configuration.appId}")
    // If you're getting this app code by cloning the repository at
    // https://github.com/mongodb/template-app-kotlin-todo, 
    // it does not contain the data explorer link. Download the
    // app template from the Atlas UI to view a link to your data.
    Log.v(TAG(),"To see your data in Atlas, follow this link:" + getString(R.string.realm_data_explorer_link))
}
© www.soinside.com 2019 - 2024. All rights reserved.