Ошибка microsoft.identitymode.tokens.audienceurivalidationfailedexception возникла при попытке открыть документ One DrivIOS

Программируем под IOS
Ответить
Anonymous
 Ошибка microsoft.identitymode.tokens.audienceurivalidationfailedexception возникла при попытке открыть документ One Driv

Сообщение Anonymous »

Я работаю в приложении iOS, необходимо открыть вложения One Drive в WKWebView.
Пример документа One Drive: https://***.sharepoint.com/personal/* ****_onmicrosoft_com/_layouts/15/Doc.aspx?sourcedoc=%7B756B3139-9729-49D2-A325-9D3B150C6A78%7D&file=export.csv&action=default&mobileredirect=true
Я получил эта ошибка "microsoft.identitymode.tokens.audienceurivalidationfailedexception была выброшена" внутри загруженного WKWebView
Пожалуйста, предложите мне исправить эту проблему.
Спасибо
p>
Мой код для загрузки документа в WKWebView:
WKWebViewConfiguration *configuration = [[WKWebViewConfiguration alloc] init];
if([[NSUserDefaults standardUserDefaults] objectForKey:[TMEUserDefaultKeys cdnSetCookie]]) {
WKUserContentController *userContentController = WKUserContentController.new;
WKUserScript *cookieScript = [[WKUserScript alloc]
initWithSource:[NSString
stringWithFormat:@"document.cookie = '%@';",
[[NSUserDefaults standardUserDefaults] objectForKey:[TMEUserDefaultKeys cdnSetCookie]]]
injectionTime:WKUserScriptInjectionTimeAtDocumentStart
forMainFrameOnly:NO];
[userContentController addUserScript:cookieScript];
[configuration setUserContentController:userContentController];
}
WKPreferences *preferences = [[WKPreferences alloc] init];
preferences.javaScriptEnabled = YES;
configuration.preferences = preferences;
configuration.allowsInlineMediaPlayback = YES;
configuration.allowsPictureInPictureMediaPlayback = YES;
configuration.mediaTypesRequiringUserActionForPlayback = WKAudiovisualMediaTypeAll;
NSArray *cookies = [[NSHTTPCookieStorage sharedHTTPCookieStorage] cookies];
for(NSHTTPCookie *cookie in cookies) {
[configuration.websiteDataStore.httpCookieStore setCookie:cookie completionHandler:nil];
}

self.webView = [[WKWebView alloc] initWithFrame:self.view.bounds configuration:configuration];
self.webView.UIDelegate = self;
self.webView.navigationDelegate = self;
self.webView.translatesAutoresizingMaskIntoConstraints = false;
self.webView.scrollView.bounces = NO;
self.webView.scrollView.showsVerticalScrollIndicator = NO;
self.webView.allowsBackForwardNavigationGestures = YES;
[self.view addSubview:self.webView];

NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:self.documentURL
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:60.0];

[request addValue:[NSString stringWithFormat:@"Bearer %@", self.oneDriveToken] forHTTPHeaderField:@"Authorization"];
[request addValue:@"https://***.sharepoint.com/.default" forHTTPHeaderField:@"scope"];
[self.webView loadRequest:request];


Подробнее здесь: https://stackoverflow.com/questions/787 ... -thrown-wh
Ответить

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

Вернуться в «IOS»