Microsoft Tech Community Live:  Microsoft Teams Edition
November 09, 2021, 08:00 AM - 12:00 PM (PST)

Validate Teams Authentication Token on Manipulation

%3CLINGO-SUB%20id%3D%22lingo-sub-1069799%22%20slang%3D%22en-US%22%3EValidate%20Teams%20Authentication%20Token%20on%20Manipulation%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1069799%22%20slang%3D%22en-US%22%3E%3CP%3EI'm%20currently%20trying%20to%20use%20the%20authentication%20token%20of%20Microsoft%20Teams%20for%20my%20own%20applications.%3C%2FP%3E%3CP%3ESo%20far%20I've%20implemented%20my%20tunneled(ngrok)%20app%20within%20a%20custom%20app%20created%20with%20App%20Studio.%20This%20app%20is%20a%20node.js%20server%2C%20which%20is%20based%20on%20the%20Quick%20Start%20Example%20found%20in%20the%20Azure%20Portal.%20This%20script%20uses%20the%20msal%20package%20to%20get%20an%20authentication%20token.%26nbsp%3B%20I%20was%20able%20to%20make%20it%20work%20and%20get%20a%20token%20of%20the%20Azure%20AD%2C%20but%20it%20seems%20to%20be%20different%20from%20the%20token%20you%20get%20at%20the%20beginning%20when%20you%20refresh%20the%20session%20of%20the%20web%20version%20of%20Mircosoft%20Teams.%26nbsp%3BThe%20token%20is%20displayed%20in%20console%20of%20your%20web%20browser.%20Sadly%20I%20couldn%E2%80%99t%20get%20a%20picture%20of%20the%20message%2C%20but%20it%20goes%20something%20like%20%E2%80%98success%20*your%20token*%E2%80%98.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ESo%20I%20have%20following%20questions%3A%3C%2FP%3E%3COL%3E%3CLI%3EWhich%20token%20is%20the%20correct%20one%2C%20if%20I%20want%20to%20validate%20the%20user%3F%20(Both%20contain%20information%20data%20about%20the%20user%2C%20so%20I%E2%80%99m%20not%20quit%20sure)%3C%2FLI%3E%3CLI%3EHow%20do%20I%20validate%20the%20token%20on%20possible%20manipulation%3F%20(I%20want%20to%20use%20the%20authentication%20data%20for%20my%20other%20non%20Microsoft%20logins%2C%20but%20need%20to%20check%20if%20there%20are%20legit)%3C%2FLI%3E%3C%2FOL%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAlready%2C%20thanks%20for%20everyone%20that%20is%20gonna%20help%20me%20with%20my%20problem%20here.%3C%2FP%3E%3CP%3E%3CSPAN%3EIf%20someone%20could%20share%20an%20example%2C%20that%20would%20also%20be%20very%20nice.%20%3A)%3C%2Fimg%3E%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1069799%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EDeveloper%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EMicrosoft%20Teams%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1073476%22%20slang%3D%22en-US%22%3ERe%3A%20Validate%20Teams%20Authentication%20Token%20on%20Manipulation%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1073476%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F470377%22%20target%3D%22_blank%22%3E%40pkulla%3C%2FA%3E%26nbsp%3BFor%20authenticating%20app%20inside%20teams%20currently%20ADAL%20js%20is%20supported%20(not%20MSAL).%3C%2FP%3E%0A%3CP%3ECan%20you%20please%20follow%20this%20doc%20for%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fmicrosoftteams%2Fplatform%2Ftabs%2Fhow-to%2Fauthentication%2Fauth-silent-aad%22%20target%3D%22_self%22%20rel%3D%22noopener%20noreferrer%22%3Eimplementing%20authentication.%3C%2FA%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1078178%22%20slang%3D%22en-US%22%3ERe%3A%20Validate%20Teams%20Authentication%20Token%20on%20Manipulation%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1078178%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F451628%22%20target%3D%22_blank%22%3E%40subhasish-MSFT%3C%2FA%3E%26nbsp%3BThanks%20for%20suggestion%2C%20but%20I've%20already%20tried%20that.%20It%20didn't%20work%20for%20me.%20I'm%20not%20quit%20sure%20if%20I%20did%20something%20wrong%2C%20but%20it%20wouldn't%20give%20me%20any%20result.%20Also%20I%20read%20that%20for%20Azure%20ver.%202%20you%20will%20need%20msal%20instead%20of%20adal.%20So%2C%20what%20should%20I%20do%20then%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1078810%22%20slang%3D%22en-US%22%3ERe%3A%20Validate%20Teams%20Authentication%20Token%20on%20Manipulation%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1078810%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F470377%22%20target%3D%22_blank%22%3E%40pkulla%3C%2FA%3E%2C%26nbsp%3BCan%20you%20please%20share%20details%20about%20what%20error%20you%20got%20when%20you%20tried%20the%20sample.%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
New Contributor

I'm currently trying to use the authentication token of Microsoft Teams for my own applications.

So far I've implemented my tunneled(ngrok) app within a custom app created with App Studio. This app is a node.js server, which is based on the Quick Start Example found in the Azure Portal. This script uses the msal package to get an authentication token.  I was able to make it work and get a token of the Azure AD, but it seems to be different from the token you get at the beginning when you refresh the session of the web version of Mircosoft Teams. The token is displayed in console of your web browser. Sadly I couldn’t get a picture of the message, but it goes something like ‘success *your token*‘.

 

So I have following questions:

  1. Which token is the correct one, if I want to validate the user? (Both contain information data about the user, so I’m not quit sure)
  2. How do I validate the token on possible manipulation? (I want to use the authentication data for my other non Microsoft logins, but need to check if there are legit)

 

Already, thanks for everyone that is gonna help me with my problem here.

If someone could share an example, that would also be very nice. :)

3 Replies

@pkulla For authenticating app inside teams currently ADAL js is supported (not MSAL).

Can you please follow this doc for implementing authentication.

@subhasish-MSFT Thanks for suggestion, but I've already tried that. It didn't work for me. I'm not quit sure if I did something wrong, but it wouldn't give me any result. Also I read that for Azure ver. 2 you will need msal instead of adal. So, what should I do then?

@pkulla, Can you please share details about what error you got when you tried the sample.