英文:
How can I add Xbox Gamertag scope in Azure App Directory sign in?
问题
EndGoal: 需要通过微软帐户在Azure应用目录中登录以获取Xbox的Gamertag。
目前只获取基本信息,如姓名、电子邮件、ID、显示名称,我只需要Gamertag来完成我的工作。
出现以下错误
AADSTS70011:提供的请求必须包含一个“scope”输入参数。
尝试将“XboxLive.signin”添加到Azure重定向的范围中,但出现了此错误。
在Azure应用配置中,我的配置已附在图像中。也找不到与Xbox相关的任何内容
或者是否有其他获取Gamertag的方法,请随时帮助。
scope: ['user.read','offline_access', 'openid'],#XboxLive.signin
在添加XboxLive.signin到范围时添加了这些内容,但出现了此错误,请指导是否有其他获取Gamertag的方法在Azure应用目录中登录。
英文:
EndGoal: Need to get Gamertag of Xbox in Azure App Directory sign in via microsoft account.
right now getting basic information name, email, id, display name i just need gamertag for my work.
Getting this error
AADSTS70011: The provided request must include a 'scope' input parameter.
Trying to add 'XboxLive.signin' this in scope of Azure Redirect and getting this error
In Azure App configuration my configuration are attached in image. also can't find any thing related to xbox
Or there is any alternate way of getting gamertag please feel free to help
scope: ['user.read','offline_access', 'openid'],#XboxLive.signin
have added these in the scope while adding XboxLive.signin in scope giving this error
please guide if there is a another way of getting gamertag in signin with Azure App Directory
答案1
得分: 2
要使用Xbox Live服务,您需要在Microsoft合作伙伴中心注册您的应用程序。然后,可以使用Xbox Live服务来获取用户配置文件,其中包括Gamertag。
要获取Xbox Live用户配置文件,您需要将Xbox Live服务添加到您的应用程序,并在登录请求中包含所需的范围。
正如在nextauthjs/next-auth
问题2779中所示:
> 在'API访问'下,需要添加'offline_access'权限以允许范围的使用。
您似乎已经完成了这一步骤。
解决此问题的一种方法可能涉及使用Xbox Services API (XSAPI)并遵循一系列特定的步骤,包括初始化游戏运行时服务、创建任务队列、初始化XSAPI、将用户登录到Xbox网络并创建XboxLiveContext对象。这种方法允许您调用Xbox服务。
然而,上述步骤更多地与在代码级别集成Xbox服务相关。它们并不直接提供在Azure App Directory中使用XboxLive.signin
范围的解决方案。
要将XboxLive.signin
范围添加到Azure应用程序注册中,您需要在Microsoft API中拥有Xbox Live Services。要获取对Xbox Live服务的访问权限,您需要在Microsoft合作伙伴中心注册您的应用程序。一旦您的应用程序在Microsoft合作伙伴中心注册成功,Xbox Live服务将出现在Microsoft API中。
请参阅“如何在Azure App Directory登录中添加Xbox Gamertag范围”。
以下是在Microsoft合作伙伴中心注册您的Web应用程序的一般步骤概述:
-
在Azure中创建或更新Web应用程序
- 转到Azure门户 - 应用程序注册页面以注册您的应用程序。使用工作或学校帐户或个人Microsoft帐户登录Azure门户。
- 选择新注册。
-
为Web应用程序配置API访问权限
- 选择您的应用程序。进入Web应用程序的设置。
- 在API访问部分,选择所需权限。
- 对于Windows Azure Active Directory权限:
- 选择Windows Azure Active Directory权限。
- 在应用程序权限中,选择读取目录数据。
- 保存权限。
- 在Web应用程序的属性部分中记录应用程序ID。
-
为您的应用程序添加秘密密钥
- 转到Web应用程序的密钥部分。
- 输入密钥描述并选择持续时间为1或2年,根据您的需要。
- 保存并复制秘密密钥值。一旦离开此页面,此值将不再显示。
-
在合作伙伴中心注册Web应用程序
- 登录到https://partnercenter.microsoft.com。
- 选择仪表板,然后选择帐户设置,然后选择应用程序管理。
- 在Web应用程序部分,选择注册现有应用程序。
- 选择您在Azure门户中创建的Web应用程序。
- 选择注册您的应用程序。
完成这些步骤后,您应该可以在Microsoft API中访问Xbox Live服务,并且应该能够将XboxLive.signin添加到Azure应用程序注册中。
请参阅在Azure门户中为Microsoft National Cloud创建合作伙伴中心应用程序详细信息的注册。
英文:
To use Xbox Live services, you will need to register your application with the Microsoft Partner Center. The Xbox Live service can then be used to fetch user profiles, which will include the Gamertag.
To fetch the Xbox Live user profile, you will need to add the Xbox Live service to your application and include the required scopes in your sign-in request.
As illustrated with nextauthjs/next-auth
issue 2779:
> Under 'API Access' the 'offline_access' permission needs to be added in order for the scope to be allowed.
You seem to have done so already.
A workaround for this problem could involve using Xbox Services API (XSAPI) and following a specific sequence of steps, which includes initializing the Gaming Runtime Services, creating a task queue, initializing XSAPI, signing the user in to the Xbox network, and creating an XboxLiveContext object. This approach allows you to make service calls to Xbox services.
However, the steps above are more related to the code-level implementation of integrating with the Xbox Services. They do not provide a direct solution to use XboxLive.signin
scope in Azure App Directory.
To add the XboxLive.signin
scope to your Azure app registration, you need to have Xbox Live Services in your Microsoft APIs. To get access to Xbox Live services, you need to register your application with the Microsoft Partner Center. Once your app is registered with the Microsoft Partner Center, Xbox Live services will get populated in the Microsoft API.
See "How can I add Xbox Gamertag scope in Azure App Directory sign in"
Here is a general outline of the steps you would take to register your web app in the Microsoft Partner Center:
-
Create or Update Web App in Azure
- Navigate to the Azure portal - App registrations page to register your app. Sign in to the Azure portal using either a work or school account or a personal Microsoft account.
- Select New registration.
-
Configure API Access Permissions for Web App
- Choose your app. Go to Settings of the Web app.
- In the API Access section, choose Required permissions.
- For Windows Azure Active Directory permissions:
- Choose Windows Azure Active Directory permissions.
- In Applications permissions, select Read directory data.
- Save the permissions.
- Note the application ID in the Properties section of your web app.
-
Add a Secret Key to Your App
- Go to the Keys section of your web app.
- Enter key description and select duration as 1 or 2 years, as you need.
- Save and copy the secret key value. This value will not be shown again once you leave this page.
-
Register the Web App in Partner Center
- Sign in to https://partnercenter.microsoft.com.
- Choose Dashboard, then choose Account Settings, then choose App Management.
- In the Web App section, choose Register existing app.
- Select the web app you created in Azure portal.
- Choose register your app.
After completing these steps, you should have access to the Xbox Live services in your Microsoft API, and you should be able to add XboxLive.signin to your Azure app registration.
See Register app details for Partner Center for Microsoft National Cloud through the Azure portal
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论