我想使用single sign-on
在IOS
上实现ADFS
功能。我做了一些研发并尝试了MSAL iOS
库进行ADFS
身份验证,但它对我不起作用。
我添加了客户端ID,ADFS身份验证的权限URL,但它不适用于我。每次它给我Couldn't acquire token
错误。
我有不同的SSO URL
,所以不使用Microsoft azure server
。
我试图以下列方式为MSAL IOS
库添加我的凭证
let kClientID = "xxxxxx-8929-4D60-B869-xxxxxxxx"
// These settings you don't need to edit unless you wish to attempt deeper scenarios with the app.
let kGraphURI = "https://graph.microsoft.com/v1.0/me/"
let kScopes: [String] = ["https://graph.microsoft.com/user.read"]
let kAuthority = "https://fs.example.com/adfs/oauth2"
任何的想法?
这里我们不需要使用MSAL iOS。有一个使用Microsoft文档的简单解决方案。点击链接:
我们只需要形成一个url字符串
这将生成一个代码,我们可以在App Delegate中的openUrl方法中获取,然后我们需要创建一个带有参数的post请求:
grant_type:authorization_code
code: xxxxx ( we got from get request)
redirect_uri: appName://
resource:http://xxxx/workflow
而已 。我们将获得access_token,我们可以进一步使用它来获取userProfile等。
希望这可以帮助!