使用 graphApi 令牌 MSAL 时未公开 Sharepoint api

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

enter image description here所以,我正在尝试从 SharePoint 读取数据。每当我尝试执行此操作时,都会收到以下错误:

AADSTS650053: The application 'Application' asked for scope 'AllSites.Read' that doesn't exist on the resource
我收到相同的写入和读取权限错误。我尝试过使用 Graph API,但它不适用于我的具体情况。

这就是范围

        "User.Read",
        "Files.Read.All",
        "Files.Read",
        "Sites.Read.All", 
        "AllSites.Read",   
        "AllSites.Write",  
        "AllSites.Manage"  
    )

登录 我想说这是非常典型的做法

 private fun signIn() {
        val parameters = SignInParameters.builder()
            .withScopes(scopes)
            .withCallback(object : AuthenticationCallback {
                override fun onSuccess(authenticationResult: IAuthenticationResult) {
                    mAccount = authenticationResult.account
                    Log.d("MainActivity", "Sign-in successful access token : ${authenticationResult.accessToken}")
                    Log.d("MainActivity", "Account: ${authenticationResult.account.username}")

                    // Fetch user data after successful sign-in

                }

                override fun onError(exception: MsalException) {
                    Log.e("MainActivity", "Sign-in failed: ${exception.message}")
                }

                override fun onCancel() {
                    Log.d("MainActivity", "Sign-in cancelled")
                }
            })
            .withActivity(this)
            .build()

        mSingleAccountApp?.signIn(parameters)
    }

初始化

  PublicClientApplication.createSingleAccountPublicClientApplication(
            this.applicationContext,
            R.raw.auth_config,
            object : IPublicClientApplication.ISingleAccountApplicationCreatedListener {
                override fun onCreated(application: ISingleAccountPublicClientApplication) {
                    mSingleAccountApp = application
                    loadAccount()

                }

                override fun onError(exception: MsalException) {
                    Log.d("MainActivity", "MSAL initialization failed: ${exception.message}")
                }
            })
azure kotlin mobile azure-ad-msal
1个回答
0
投票

此问题的问题是 MSAL 要求对共享点使用不同的身份验证,因此我必须使用图形 api 访问来获取文件而不是 REST 共享点并删除这些权限。

© www.soinside.com 2019 - 2024. All rights reserved.