error TF30063: Force prompt for credentials when connecting programmatically to visualstudio.com

橙三吉。 提交于 2020-01-06 06:25:25

问题


I'm aware of alternate credentials (Authenticating to hosted TFS: TF30063: You are not authorized to access .visualstudio.com) but I need users to be prompted for the credentials when connecting to visualstudio.com.

Similar in spirit to the code below, which does not work

var aTeamProjects = new TfsTeamProjectCollection(m_oTfsCollectionUri);
aTeamProjects.ClientCredentials.PromptType = CredentialPromptType.PromptIfNeeded;
aTeamProjects.Authenticate();

In the code above the Authenticate-request results in TF30063: You are not authorized to access .visualstudio.com.


回答1:


The solution is working on a new project with the code below. Then provide the credentials if it is asked when running an app.

var credentials = new VssClientCredentials();
credentials.PromptType = CredentialPromptType.PromptIfNeeded;
var aTeamProjects = new TfsTeamProjectCollection(m_oTfsCollectionUri, credentials);
aTeamProjects.EnsureAuthenticated();


来源:https://stackoverflow.com/questions/46075533/error-tf30063-force-prompt-for-credentials-when-connecting-programmatically-to

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!