Forum Discussion
SadPython
Jun 25, 2024Copper Contributor
How to call microsoft graph api inside my web app?
I have a web app embedded in MS Teams. I'm trying to figure out how to call the MS Graph API in my JS code to get user information. How can I do that?
SadPython
Jun 26, 2024Copper Contributor
How do I do step 1? This is an external facing app and the user is logged into teams. When they install or open the tab, I want to prompt them that specific permissions are required and if they accept then my app grabs user information. All of the guides I see are using SSO but I can't manage SSO on my side and the client's side.
Nivedipa-MSFT
Microsoft
Jul 03, 2024To register an external facing app with Azure AD for Teams without using Single Sign-On (SSO), you can follow these general steps:
-
Register Your App in Azure AD:
- Go to the Azure portal and navigate to the Azure Active Directory service.
- Select "App registrations" and then "New registration."
- Fill in the required details such as the name of your app and the redirect URI (the URL where your app will receive the authentication response).
- Once registered, you will receive an Application (client) ID.
-
Configure Permissions:
- In the app registration, navigate to "API permissions."
- Add the necessary Microsoft Graph permissions that your app requires, such as
User.Read
. - If admin consent is required for the permissions, you'll need to request that from the tenant admin.
-
Prompt Users for Consent:
- When users install or open the tab, you can prompt them for consent using the OAuth 2.0 authorization code flow.
- Your app will redirect users to the Microsoft login page where they can consent to the permissions your app requires.
- After consent, Azure AD will redirect back to your app with an authorization code, which you can exchange for an access token.
-
Use the Access Token:
- With the access token, your app can call Microsoft Graph API to grab user information.