@@ -34,6 +34,7 @@ import MSAL
3434class ViewController : UIViewController , UITextFieldDelegate , URLSessionDelegate {
3535
3636 let kTenantName = " fabrikamb2c.onmicrosoft.com " // Your tenant name
37+ let kAuthorityHostName = " fabrikamb2c.b2clogin.com " // Your authority host name
3738 let kClientID = " 90c0fe63-bcf2-44d5-8fb7-b8bbc0b29dc6 " // Your client ID from the portal when you created your application
3839 let kSignupOrSigninPolicy = " b2c_1_susi " // Your signup and sign-in policy you created in the portal
3940 let kEditProfilePolicy = " b2c_1_edit_profile " // Your edit policy you created in the portal
@@ -42,7 +43,7 @@ class ViewController: UIViewController, UITextFieldDelegate, URLSessionDelegate
4243 let kScopes : [ String ] = [ " https://fabrikamb2c.onmicrosoft.com/helloapi/demo.read " ] // This is a scope that you've configured your backend API to look for.
4344
4445 // DO NOT CHANGE - This is the format of OIDC Token and Authorization endpoints for Azure AD B2C.
45- let kEndpoint = " https://login.microsoftonline.com /tfp/%@/%@ "
46+ let kEndpoint = " https://%@ /tfp/%@/%@ "
4647
4748 var application : MSALPublicClientApplication !
4849
@@ -364,7 +365,7 @@ class ViewController: UIViewController, UITextFieldDelegate, URLSessionDelegate
364365 use for the current user flow.
365366 */
366367 func getAuthority( forPolicy policy: String ) throws -> MSALB2CAuthority {
367- guard let authorityURL = URL ( string: String ( format: self . kEndpoint, self . kTenantName, policy) ) else {
368+ guard let authorityURL = URL ( string: String ( format: self . kEndpoint, self . kAuthorityHostName , self . kTenantName, policy) ) else {
368369 throw NSError ( domain: " SomeDomain " ,
369370 code: 1 ,
370371 userInfo: [ " errorDescription " : " Unable to create authority URL! " ] )
0 commit comments