热门通过Azure移动应用程序获取Azure AD Id_token?

时间:2017-10-23 08:53:27

标签: azure azure-active-directory azure-mobile-services azure-ad-graph-api azure-authentication

我试图通过Azure移动应用程序获取Id_token但我收到了mobileServiceAuthenticationToken。

我的iOS-App收到了mobileServiceAuthenticationToken,其实现如下:Integrate Azure AD into an iOS app

我需要Id_token(使用算法RS256),因为我的后端服务(java spring-boot)需要验证此令牌,这对于mobileServiceAuthenticationToken是不可能的。 mobileServiceAuthenticationToken基于算法HS256(需要客户端密钥),并且不允许请求Azure AD通过Microsoft Graph Api获取用户信息。

以下是微软参考的链接以获取更多信息:Azure AD token reference

1 个答案:

答案 0 :(得分:0)

id_token无法调用Microsoft Graph REST。要调用Microsoft Graph REST,我们需要获取access_token声称为aud的相应https://graph.microsoft.com

移动身份验证有两种流,即客户端流和服务器流。它们都应该在你的场景中工作,但是进展有点不同。

客户流程: 对于此流程,您可以首先使用ADAL SDK从Azure Active Directory获取Microsoft Graph的id_tokenaccess_token。然后,您可以将id_token与EasyAuth交换为身份验证令牌并登录您的移动应用程序。

服务器流程:您可以配置移动应用以获取Microsoft Graph的 access_token 。然后,您可以在移动后端实现代理。之后,您只需要将移动后端称为所有者服务和Microsoft Graph。

以下是一些有关此主题的有用文章:

How to: Authenticate users with the Active Directory Authentication Library

App Service Auth and the Azure AD Graph API

相关问题