Я инициализирую InteractiveBrowserCredentialOptions
Код: Выделить всё
private readonly string[] _scopes = new[] { "https://graph.microsoft.com/.default" };
private const string AUTH_RECORD_PATH = "./tokencache.bin";
_options = new InteractiveBrowserCredentialOptions
{
TenantId = tenantId,
ClientId = clientId,
AuthorityHost = AzureAuthorityHosts.AzurePublicCloud,
RedirectUri = new Uri("http://localhost:8080/secret"),
TokenCachePersistenceOptions = new TokenCachePersistenceOptions
{
Name = "OneDriveService",
UnsafeAllowUnencryptedStorage = true
}
};
Код: Выделить всё
AuthenticationRecord authRecord = await interactiveCredential.AuthenticateAsync();
using (var authRecordStream = new FileStream(AUTH_RECORD_PATH, FileMode.Create, FileAccess.Write))
{
await authRecord.SerializeAsync(authRecordStream);
}
Я пытался изменить область действия и разрешения API в записи, в настоящее время у меня есть File.ReadWrite.All, Application.ReadWrite.All, Directory.ReadWrite.All, AuthenticationContext.Read.All, offline_access, openid, профиль, User.read.
Но это не помогло.
Подробнее здесь: https://stackoverflow.com/questions/792 ... dsts650057
Мобильная версия