验证azure-devops PAT [英] Validate the azure-devops PAT
问题描述
我已经从天蓝色的开发人员创建了PAT.现在,我创建了一个React应用程序来处理所有api逻辑.我现在有一个登录屏幕,用户需要输入DEVOPS_TOKEN,ORGANISATION_NAME.我如何在登录时验证用户令牌.我找不到用于验证用户的任何API.
I have created an PAT from azure devops. Now i have create a react app to handle all the api logics. I have a login screen now user need to enter the DEVOPS_TOKEN, ORGANISATION_NAME. How can i validate the user token at login. I couldn't find any api for validate the user.
任何建议都会有所帮助.
Any suggestions would be helpful.
推荐答案
经过一番调查,我发现了一种验证用户身份的方法.Azure Devops中提供了一个api: https://dev.azure.com/ {ORGANISATION_NAME}/_ apis/connectionData.
After a bit of investigation i found out a way to validate the user. There is an api that is available in Azure Devops: https://dev.azure.com/{ORGANISATION_NAME}/_apis/connectionData.
需要在标头参数中传递编码后的令牌,这会导致用户授权.
Need to pass the encoded token in header parameter that results the user authorization.
{
"authenticatedUser": {
"id": "123-13-131231231-123-123-123-123",
"descriptor": "Microsoft.IdentityModel.Claims.ClaimsIdentity;123-13-131231231-123-123-123-123\\user@domain.com",
"subjectDescriptor": "aad.Masdasdpadspoadsjpaodsjapodj",
"providerDisplayName": "User Name",
"isActive": true,
"properties": {
"Account": {
"$type": "System.String",
"$value": "user@domain.com"
}
},
"resourceVersion": 2,
"metaTypeId": 0
},
"authorizedUser": {
"id": "123-13-131231231-123-123-123-123",
"descriptor": "Microsoft.IdentityModel.Claims.ClaimsIdentity;123-13-131231231-123-123-123-123\\user@domain.com",
"subjectDescriptor": "aad.Masdasdpadspoadsjpaodsjapodj",
"providerDisplayName": "User Name",
"isActive": true,
"properties": {
"Account": {
"$type": "System.String",
"$value": "user@domain.com"
}
},
"resourceVersion": 2,
"metaTypeId": 0
},
"instanceId": "123-13-131231231-123-123-123-123",
"deploymentId": "123-13-131231231-123-123-123-123",
"deploymentType": "hosted",
"locationServiceData": {
"serviceOwner": "123-13-131231231-123-123-123-123",
"defaultAccessMappingMoniker": "PublicAccessMapping",
"lastChangeId": 12313123,
"lastChangeId64": 123123123
}
}
这篇关于验证azure-devops PAT的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!