Reputation: 503
I have created an angular app and integrated with MS Teams using tab.
I'm also able to authenticate user within microsoft teams app and able to get logged in user token using Microsoft Teams Javascript SDK.
I'm not getting how to authenticate Azure DevOps within MS Teams app.
How to get access token for Azure DevOps within my custom teams angular app, so that I can use it to deal with Azure DevOps?
Upvotes: 1
Views: 1765
Reputation: 9549
Assuming your application is in Azure AD, it is very simple to obtain an access token for Azure DevOps, you only need to set the scope to: https://app.vssps.visualstudio.com/user_impersonation
.
First, you need to grant the Azure DevOps user_impersonation
delegation permission to the application, and then use the auth code flow to obtain an access token.
Next, use the auth code flow to obtain an access token.
https://login.microsoftonline.com/{tenant id}/oauth2/v2.0/authorize?
client_id={client id}
&response_type=code
&redirect_uri={redirect_uri}
&response_mode=query
&scope=https://app.vssps.visualstudio.com/user_impersonation
&state=12345
2.Redeem token.
Parse the token and view the aud
claim.
The token will contain the logged-in user information, and have full access to Visual Studio Team Services REST APIs.
Upvotes: 1