Microsoft identity platform --- Sign in users

I have recently encountered some problems integrating Azure AD. The main problem is login. If you are confused about the official document, hopefully this can help you .

App Registrations

Firstly, you must have a App Registrations. How to register a new App? you can do as flows:

Create a new App registrations

you can search key words, such as App Registrations in the top search blank and click the function button named App Registrations below Services. just show in the pic.
在这里插入图片描述
then select New registration to create a new one.(I don`t have the access to create it in my group, but I think it is ok to skip these parts.)

在这里插入图片描述
you may need to fill some blank info, you can refer official document steps:

  • In the Name section, enter a meaningful application name that will be displayed to users of the app, for example java-spring-webapp-auth.
  • Under Supported account types, select Accounts in this organizational directory only.
  • In the Redirect URI (optional) section, select Web in the combo-box and enter the following redirect URI: http://localhost:8080/login/oauth2/code/.

Select Register to create the application.

You also need to create secret key :
在这里插入图片描述
You’ll need this key later in your code’s configuration files. This key value will not be displayed again, and is not retrievable by any other means, so make sure to note it from the Azure portal before navigating to any other screen or blade.

Build App

You can download code demo from : github repo

Configure the webApp app (java-spring-webapp-auth) to use your app registration. Open the project in your IDE(Vs code or Idea) to configure the code.

Configure the webApp app (java-spring-webapp-auth) to use your app registration

  • Open the src\main\resources\application.yml file.
  • Find the key Enter_Your_Tenant_ID_Here and replace the existing value with your Azure AD tenant ID.
  • Find the key Enter_Your_Client_ID_Here and replace the existing value with the application ID (clientId) of java-spring-webapp-auth app copied from the Azure portal.
  • Find the key Enter_Your_Client_Secret_Here and replace the existing value with the key you saved during the creation of java-spring-webapp-auth copied from the Azure portal.

Other Important Settings

If you have finished all of steps and the login action is fail just like the pic:
在这里插入图片描述
I think there must be some other setting in Azure AD get wrong configurations. You may try to update these settings:

  • config redirect urls
    在这里插入图片描述
    copy the url and configure it followed the pic guide and then try to login again :
    在这里插入图片描述
    Result: Success View
    在这里插入图片描述

Hope this can help you ! Any future questions can have a private communication with me.😘

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值