Important
This learning sample is for educational purposes only and should not be used in any production use case. It is intended to highlight concepts of Semantic Kernel and not any architectural / security design practices to be used.
Watch the Authenticated API’s Sample Quick Start Video
- You will need an Open AI Key or Azure Open AI Service key for this sample
- Ensure the KernelHttpServer sample is already running at
http://localhost:7071
. If not, follow the steps to start it here. - You will also need to
register your application
in the Azure Portal. Follow the steps to register your app
here.
- Select
Single-page application (SPA)
as platform type, and the Redirect URI will behttp://localhost:3000
- Select
Personal Microsoft accounts only
as supported account types for this sample
- Select
- Copy .env.example into a new file with name ".env".
Note: Samples are configured to use chat completion AI models (e.g., gpt-3.5-turbo, gpt-4, etc.). See https://platform.openai.com/docs/models/model-endpoint-compatibility for chat completion model options.
- Once registered, copy the Application (client) ID from the Azure Portal and paste
the GUID into the .env file next to
REACT_APP_GRAPH_CLIENT_ID=
(first line of the .env file). - Run the following command
yarn install
(if you have never run the sample before) and/oryarn start
from the command line. - A browser will automatically open, otherwise you can navigate to
http://localhost:3000
to use the sample.
Working with Secrets: KernelHttpServer's Readme has a note on safely working with keys and other secrets.
The Authenticated API’s sample allows you to use authentication to connect to the Microsoft Graph using your personal account.
If you don’t have a Microsoft account or do not want to connect to it, you can review the code to see the patterns needed to call out to APIs.
The sample highlights connecting to Microsoft Graph and calling APIs for Outlook, OneDrive, and ToDo. Each function will call Microsoft Graph and/or Open AI to perform the tasks.
Caution
Each function will call Open AI which will use tokens that you will be billed for.
-
Ensure in your Application Manifest that
Personal Microsoft accounts
are allowed to sign in."signInAudience": "PersonalMicrosoftAccount"
or"signInAudience": "AzureADandPersonalMicrosoftAccount"
-
If you are not able to change the manifest, create a new Application following the instructions in Running the sample, step 3.