1
votes

I'm just wondering in this article https://docs.microsoft.com/en-us/rest/api/resources/tenants/list enter image description here there's a "try it" button once you click it, it will list all your tenant or directory. enter image description here then once you select any of the directory it will give you a bearer token. enter image description here.

The question is, is there's a way to get a bearer token thru API? Or get a bearer token that depends on the selected tenant? Thanks!

By the return token of that site, im passing it thru this api https://app.vssps.visualstudio.com/_apis/accounts to get all my organization base on the selected tenant.

1
What kind of app are you building? How you acquire tokens depends on that. - juunas
Im just wondering of there's an way or api that will give me that bearer token. I'm working with Azure Web API. - user2530833

1 Answers

0
votes

You can get the access token (Bearer) via below API. Please refer the link. https://docs.microsoft.com/en-us/azure/active-directory/develop/v2-oauth-ropc

Normally if you need to access any azure resource, then you have to create AAD app in that tenant in order to get the token. But your case, you have to get all Tenant details via REST api. So You can create the AAD app on of your tenant.