简体   繁体   English

如何使用 azure 登录使用 electron 和 angular

[英]How to use azure login using electron and angular

I am trying to implement azure authentication in my electron application, I already created an angular app where all works fine so when the application loads it redirected to azure login page and if auth is done it will redirect back to application I am using msal-angular. I am trying to implement azure authentication in my electron application, I already created an angular app where all works fine so when the application loads it redirected to azure login page and if auth is done it will redirect back to application I am using msal-angular .

Now I am converting this application to the electron.现在我正在将此应用程序转换为 electron。 In electron, load the dist folder of angular.在 electron 中,加载 angular 的 dist 文件夹。 After successful login, need to redirect to application, but shows invalid schema error because of file:// schema is there in redirect uri.成功登录后,需要重定向到应用程序,但显示无效架构错误,因为重定向 uri 中有 file:// 架构。 also can't register that schema to azure portal.也无法将该架构注册到 azure 门户。

so, how can we redirect to application.那么,我们如何重定向到应用程序。

in main.js (electron)在 main.js(电子)中

mainWindow.loadURL(url.format({ 
    pathname: path.join(__dirname, 'dist/index.html'),
    protocol: 'file:',
    slashes: true,
}));

in angular app在 angular 应用程序中

redirectUri: '/'

Wrapper Library包装库

MSAL Angular (@azure/msal-angular)

Thank you Anand Sowmithiran .谢谢阿南德·索米蒂兰 Posting your suggestion as an answer to help other community members.发布您的建议作为帮助其他社区成员的答案。

You can use openid appauth module to do authentication with your Azure AD using OpenID(OIDC) and give RedirectUri as localhost:8000 or some other.您可以使用 openid appauth 模块使用 OpenID(OIDC) 对 Azure AD 进行身份验证,并将 RedirectUri 指定为localhost:8000或其他。 Even though the below article is based on Okta, you can follow similar approach to authenticate with Azure AD for your electron app.即使下面的文章基于 Okta,您也可以按照类似的方法使用 Azure AD 对您的 electron 应用程序进行身份验证。 Electron Example Electron 示例

You can refer to How to use azure login using electron and angular , How to use with electron?可以参考How to use azure login using electron and angular , How to use with Z1B856203431169FEDC524? and Is there any way to login with AzureAD in electron js? 有没有办法在 electron js 中使用 AzureAD 登录?

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

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