简体   繁体   中英

"Authentication Client ID is not configured", I am making a react SPA of a microsoft login page for my application using azure. What is my mistake?

This is what I have done:

I added a .env file on the root Level:

REACT_APP_AZURE_ACTIVE_DIRECTORY_APP_CLIENT_ID = (Client ID)

Then I added three files under src subfolder.

Then I changed the code of app.tsx to a new one as I was asked.

This is the tutorial I am following .

https://learn.microsoft.com/en-us/azure/developer/javascript/tutorial/single-page-application-azure-login-button-sdk-msal

I don't change anythings in project. Just paste client_id into .env file.

And I also follow the offical doc, create app regidtration, add spa and so on.

在此处输入图像描述

在此处输入图像描述

My test steps:

  1. Download sample peoject code from the link you provided.

  2. Open it by vscode, run cmd npm i .

  3. Copy and paste clientid into .env file.

    在此处输入图像描述

  4. Then excute cmd npm run start . It works fine.

    在此处输入图像描述

    在此处输入图像描述

I was also following the MS tutorial and encountered the same problem. What I needed to do was:

  1. Stop the development server (by pressing [CTRL]+[C])
  2. Run npm i (I don't now if this step is needed)
  3. Start the development server again: npm run start

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM