Reputation: 1656
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.
Upvotes: 3
Views: 1898
Reputation: 1656
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\\[email protected]",
"subjectDescriptor": "aad.Masdasdpadspoadsjpaodsjapodj",
"providerDisplayName": "User Name",
"isActive": true,
"properties": {
"Account": {
"$type": "System.String",
"$value": "[email protected]"
}
},
"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\\[email protected]",
"subjectDescriptor": "aad.Masdasdpadspoadsjpaodsjapodj",
"providerDisplayName": "User Name",
"isActive": true,
"properties": {
"Account": {
"$type": "System.String",
"$value": "[email protected]"
}
},
"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
}
}
Upvotes: 6