Entra and MIP Errror using C# .AccessDeniedException: The service didn’t accept the auth token. Challenge:[”]

Here is the error message I get, we are using a login and password to get the auth token
just not sure what permissions we need.

“Microsoft.InformationProtection.Exceptions.AccessDeniedException: The service didn’t accept the auth token. Challenge:[”] HttpRequest.Id={E0C61208-D90F-49FF-83E0-2A17F8D3DB9A}, CorrelationId=0a882288-d5e3-4b7a-812b-a5dc5a779271, CorrelationId.Description=PolicyProfile

at EmailSDK.Program.<>c__DisplayClass2_0.<b__1>d.MoveNext() in C:UsersDaHackersourcereposEmailSDKProgram.cs:line 56″

here is the code I have it is from MS’s quick guide

  MIP.Initialize(MipComponent.File);
    
    // Create ApplicationInfo, setting the clientID from Microsoft Entra App Registration as the ApplicationId.
    
    ApplicationInfo appInfo = new ApplicationInfo()
    
    {
    
        ApplicationId = clientId,
    
        ApplicationName = appName,
    
        ApplicationVersion = "1.0.0"
    
    };
    
     
    
    // Instantiate the AuthDelegateImpl object, passing in AppInfo.
    
    AuthDelegateImplementation authDelegate = new AuthDelegateImplementation(appInfo);
    // Create MipConfiguration Object
    
    MipConfiguration mipConfiguration = new MipConfiguration(appInfo, "mip_data", LogLevel.Trace ,false);
    // Create MipContext using Configuration
    
    using (MipContext mipContext = MIP.CreateMipContext(mipConfiguration))
    
    {
    
        // Initialize and instantiate the File Profile.
        // Create the FileProfileSettings object.
        // Initialize file profile settings to create/use local state.
    
         FileProfileSettings profileSettings = new FileProfileSettings(mipContext,CacheStorageType.OnDiskEncrypted,
                                 new ConsentDelegateImplementation());
    
         // Load the Profile async and wait for the result.
    
        IFileProfile fileProfile = Task.Run(async () => await MIP.LoadFileProfileAsync(profileSettings)).Result;
    
        // Create a FileEngineSettings object, then use that to add an engine to the profile.
    
        // This pattern sets the engine ID to [email protected], then sets the identity used to create the engine.
    
        FileEngineSettings engineSettings = new FileEngineSettings("[email protected]", authDelegate, "", "en-US");
    
        engineSettings.Identity = new Identity([email protected]);
        IFileEngine fileEngine = null;
    
        try
    
        {
    
     
    
            fileEngine =    Task.Run(async () => await fileProfile.AddEngineAsync(engineSettings)).Result;
    
        }
    
        catch (Exception ex)
    
        {
     
    
        // Application Shutdown
    
        // handler = null; // This will be used in later quick starts.
    
        fileEngine = null;
    
        fileProfile = null;
    
        mipContext.ShutDown();
     
    }
    
    
            public AuthDelegateImplementation(ApplicationInfo appInfo)
    
            {
    
                _appInfo = appInfo;
            }
    
            public string AcquireToken(Identity identity, string authority, string resource, string claims)
    
            {
                authority = https://graph.microsoft.com/.default;
                var authorityUri = new Uri(authority);
    
                authority = String.Format([https://%7b0%7d/%7b1%7d]https://{0}/{1}, authorityUri.Host, "10462954-a52f-469d-9f83-8ac832d15e78");
    
                _app = PublicClientApplicationBuilder.Create(_appInfo.ApplicationId).WithTenantId("10462954-a52f-469d-9f83-8ac832d15e78").Build();
    
                var accounts = (_app.GetAccountsAsync()).GetAwaiter().GetResult();
    
                string[] scopes = new[] { "User.Read.All" };
    
               // string[] scopes = new[] { "Files.ReadWrite.All" };
    
                
                var result = _app.AcquireTokenByUsernamePassword(scopes, "UserEmail:[email protected]", "Password: LetMeIn")
    
                           .ExecuteAsync().ConfigureAwait(false).GetAwaiter().GetResult();
    
                return result.AccessToken;
    
            }

1

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật