{"action":"closed","issue":{"url":"https://api.github.com/repos/OneDrive/onedrive-sdk-dotnet-msa-auth-adapter/issues/21","repository_url":"https://api.github.com/repos/OneDrive/onedrive-sdk-dotnet-msa-auth-adapter","labels_url":"https://api.github.com/repos/OneDrive/onedrive-sdk-dotnet-msa-auth-adapter/issues/21/labels{/name}","comments_url":"https://api.github.com/repos/OneDrive/onedrive-sdk-dotnet-msa-auth-adapter/issues/21/comments","events_url":"https://api.github.com/repos/OneDrive/onedrive-sdk-dotnet-msa-auth-adapter/issues/21/events","html_url":"https://github.com/OneDrive/onedrive-sdk-dotnet-msa-auth-adapter/issues/21","id":183233096,"number":21,"title":"OnlineIdAuthenticationProvider doesn't work in a background task","user":{"login":"ericpapamarcos","id":282771,"avatar_url":"https://avatars.githubusercontent.com/u/282771?v=3","gravatar_id":"","url":"https://api.github.com/users/ericpapamarcos","html_url":"https://github.com/ericpapamarcos","followers_url":"https://api.github.com/users/ericpapamarcos/followers","following_url":"https://api.github.com/users/ericpapamarcos/following{/other_user}","gists_url":"https://api.github.com/users/ericpapamarcos/gists{/gist_id}","starred_url":"https://api.github.com/users/ericpapamarcos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ericpapamarcos/subscriptions","organizations_url":"https://api.github.com/users/ericpapamarcos/orgs","repos_url":"https://api.github.com/users/ericpapamarcos/repos","events_url":"https://api.github.com/users/ericpapamarcos/events{/privacy}","received_events_url":"https://api.github.com/users/ericpapamarcos/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":10,"created_at":"2016-10-15T21:08:04Z","updated_at":"2016-11-01T17:54:37Z","closed_at":"2016-11-01T17:54:37Z","body":"`OnlineIdAuthenticationProvider` is great for not prompting UI for credentials if an account is already connected to the device, but it doesn't work in a background task.\n\nSample code (UWP):\n\n```\nmsaAuthenticationProvider = new OnlineIdAuthenticationProvider(scopes);\nawait msaAuthenticationProvider.AuthenticateUserAsync();\n```\n\nThis returns the following error: **Code: authenticationFailure\nMessage: The request is not supported. (Exception from HRESULT: 0x80070032)**\n\nThe culprit seems to be the `CredentialPromptType` within the `GetAccountSessionAsync` method. Even though the description for `CredentialPromptType.PromptIfNeeded` says \"Show the UI only if an error occurred\" and no error should be occurring, it returns the error message above.\n\nSwitching this type to `CredentialPromptType.DoNotPrompt` makes the scenario work in a background task, but of course there would need to be multiple code paths so that an app could prompt if this was the user's first time using the app, etc.\n\nIs this the right approach to enable usage in a background task? Or is there an alternative recommended approach?\n"}}
{"actor":{"display_login":"cdmayer"}}