1

I build a teams bot by C#, I just want get current user's id_token like this:

{
  "aud": "9b7071c8-3ce9-4109-abfc-e20f6dc8565c",
  "iss": "https://login.microsoftonline.com/03d1e802-a5a6-4eb7-955b-d54457506f5c/v2.0",
  "iat": 1663465148,
  "nbf": 1663465148,
  "exp": 1663469048,
  "aio": "ATQAy/8TAAAAFanCzNbk05lLbfiU/m5YKbKRwbney5rbhw0PhcM5K5OF9CCfXvn4gYPGwqbA39Tw",
  "name": "Feng Arthur",
  "nonce": "637990622396675459.OTQzODRjMTYtMTk1Zi00ZmQyLWE5ZDctMWUwYjEzMzE4ZmRmMTJlM2M0MzAtN2E2Ni00ZWVkLWFhNWEtYTM4MDg4MWY4MTc2",
  "oid": "55e8ac69-83bb-4bfd-a62c-71935718612d",
  "preferred_username": "arthur@xxx.onmicrosoft.com",
  "rh": "0.AVYAAujRA6alt06VW9VEV1BvXMhxcJvpPAlBq_ziD23IVlyfALw.",
  "sub": "Om7ssbXuWuSgDT5u4VTpbYyU84kA7X0lwfzGekzUJw0",
  "tid": "03d1e802-a5a6-4eb7-955b-d54457506f5c",
  "uti": "qHqwpvM_30SG05JzQlgTAA",
  "ver": "2.0"
}

But I use https://learn.microsoft.com/en-us/microsoftteams/platform/bots/how-to/authentication/add-authentication?tabs=dotnet%2Cdotnet-sample example, this token like this:

{
  "aud": "00000003-0000-0000-c000-000000000000",
  "iss": "https://sts.windows.net/03d1e802-a5a6-4eb7-955b-d54457506f5c/",
  "iat": 1663467221,
  "nbf": 1663467221,
  "exp": 1663472207,
  "acct": 0,
  "acr": "1",
  "aio": "ATQAy/8TAAAA6/94ZNRnQs+16hbYjapVYf0cAkUkIcNwLNbToEMjS3wtAyBnTVwDCLZ6Bbcu97P9",
  "amr": [
    "pwd"
  ],
  "app_displayname": "TeamsApp",
  "appid": "9b7071c8-3ce9-4109-abfc-e20f6dc85655",
  "appidacr": "1",
  "family_name": "Guo",
  "given_name": "Arthur",
  "idtyp": "user",
  "ipaddr": "137.83.237.197",
  "name": "Guo Zhifeng",
  "oid": "55e8ac69-83bb-4bfd-a62c-71935718612d",
  "platf": "3",
  "puid": "1003200226D5C04D",
  "rh": "0.AVYAAujRA6alt06VW9VEV1BvXAMAAAAAAAAAwAAAAAAAAACfALw.",
  "scp": "Mail.Read User.Read User.ReadBasic.All profile openid email",
  "sub": "nnK6b2HVSxUjxjaVmttlfiXlvC0bnTYU5UmduhqQxBU",
  "tenant_region_scope": "AS",
  "tid": "03d1e802-a5a6-4eb7-955b-d54457506f5c",
  "unique_name": "arthur@arthurguo.onmicrosoft.com",
  "upn": "arthur@arthurguo.onmicrosoft.com",
  "uti": "phR1FN8unEu6PaSDRralAA",
  "ver": "1.0",
  "wids": [
    "62e90394-69f5-4237-9190-012177145e10",
    "b79fbf4d-3ef9-4689-8143-76b194e85509"
  ],
  "xms_st": {
    "sub": "Om7ssbXuWuSgDT5u4VTpbYyU84kA7X0lwfzGekzUJw0"
  },
  "xms_tcdt": 1662039680
}

Here is my settings:

  1. Azure Bot OAuth Connection String(Image)
  2. App regisrations -> Manifest -> accessTokenAcceptedVersion

Want to use "iss": "https://login.microsoftonline.com/03d1e802-a5a6-4eb7-955b-d54457506f5c/v2.0", not "iss": "https://sts.windows.net/03d1e802-a5a6-4eb7-955b-d54457506f5c/"

Arthur
  • 11
  • 1
  • You can get access token but not id_token with existing code. You would need to provide your own authentication flow implementation. – Meghana-MSFT Sep 20 '22 at 10:21

0 Answers0