繁体   English   中英

如何正确地导入和使用MSAL(用于js的Microsoft身份验证库)到javascript(非打字稿)反应单页应用程序中?

[英]How to properly import and use the MSAL (Microsoft Authentication Library for js) into a javascript (non typescript) react single page application?

我试图将Msal导入reactjs应用程序。 由于该应用程序是由create-react-app创建的,因此项目本身中没有webpack加载器。 我无法参考Msal。 尝试过:

var Msal = require('msal/out/msal.js');
var Msal = require('msal');
import Msal from 'msal';
import {Msal} from 'msal';

总是有一个空的Msal,而没有用于创建连接器的构造函数。

var userAgentApplication = new **Msal**.UserAgentApplication("your_client_id", null, function (errorDes, token, error, tokenType) {
              // this callback is called after loginRedirect OR acquireTokenRedirect (not used for loginPopup/aquireTokenPopup)
        })

可以导入msal 0.1.3请参阅https://github.com/sunilbandla/vue-msal-sample

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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