问题描述
我使用flask dance make_azure_blueprint 将一个可用的azure 身份验证层设置为flask 应用程序。
blueprint = make_azure_blueprint(
client_id=client_id,client_secret=client_secret,tenant=tenant_id,scope=[
scopes.Email,scopes.DirectoryReadAll,scopes.OpenID,scopes.Profile,scopes.UserRead,scopes.UserReadAll,],login_url=LOGIN_URL_PATH,authorized_url=AUTH_CALLBACK_URL_PATH,redirect_url='http://localhost:5000/',)
app.register_blueprint(blueprint,url_prefix="/login")
范围在哪里: 范围 -
DirectoryReadAll = 'Directory.Read.All'
Email = 'email'
GroupMemberReadAll = 'GroupMember.Read.All'
Profile = 'profile'
OpenID = 'openid'
UserReadBasicAll = 'User.ReadBasic.All'
UserRead = 'User.Read'
UserReadAll = 'User.Read.All'
使用它,我能够检索用户信息并显示在应用程序上。现在我正在尝试结合 Azure 时间序列洞察范围“https://api.timeseries.azure.com//user_impersonation”。但这会返回一个错误,指出这不能与特定于资源的组混合。 enter image description here
解决方法
无法满足您的需求。
您似乎尝试访问 default
范围和 user_impersonation
范围的两个 API。实际上我们不能使用多个作用域来访问 api。
您应该将要访问的 api 放在范围内。比如要访问MS graph api,可以放https://graph.microsoft.com/.default
。如果要访问自定义api,可以输入api://{back-end app client api}/scope name
。