iOS MSAL.framework kept prompting for credentials with Azure AD B2C Edit Profile flow - swift

I was following the active-directory-b2c-ios-swift-native-msal sample code. All was fine but when invoking edit profile flow, I was asked to enter credentials again. It was like B2C couldn't recognize that I was already authenticated and prompted me every time I went to the edit profile user flow. In comparison, this ms-identity-b2c-javascript-spa Javascript SPA works. So I don't think it's my B2C configuration.
This happened to both simulator and real device with iOS 14.x. (I didn't try previous version of iOS.) Has anyone encountered the same issue? I doubt this is the intended behavior of the sample code. Anyone aware of a solution? Thanks for the help.

As part of the call to edit profile, pass in a loginHint parameter with value set to the users identifier (usually their email). I believe otherwise, in the absence of loginHint, MSAL iOS will pass in prompt=login and causes the cookies to get cleared, forcing the user to login again. The object that contains loginHint is MSALInteractiveTokenParameters.

Related

Xamarin and Facebook authentication

I'm looking for a solution on some problem.
We have mobile app on Xamarin and requirement to sign in with Facebook credentials.
To solve this we use Xamarin.Auth also tried CloudRail.
In both cases it works but it needs to input credentials when you laungh app first time, then app remebmers and allow to use them again.
Here is question. Maybe some one know how to skip that step, and login in app via Facebook with no one first time input credentials?
Like in GMail or Shazam. You download app, click Sign in with Facebook and it does't requires to input credentials, it's already known.
You could use
Facebook Xamairn Components
, which contains binding for Xamarin.iOS or Xamarin.Android.

Can a user's AccountKit id for an app ever change?

I've integrated Facebook's AccountKit as the login system for my app. It has some bugs but usually works fine.
My developer reported a fairly bad experience though recently. He had to restart his computer, thus clearing the sessions, and when he went to re-login to the app via AccountKit, he realized that the same email address he had been using returned a different user_id than the one it had been returning previously. This of course caused a problem in that our backend could not find any account relating to the new Accountkit id.
I've been unable to find much information about this. I'm wondering if this is a bug or a feature! Any further illumination on this subject is greatly appreciated!
Every login will return a different Access Token or Authorization Code as documented here: https://developers.facebook.com/docs/accountkit/accesstokens
If you get the Account ID from the Access Token, it should always be the same for a user entering the same email address. What you're describing sounds like a bug and if you can still reproduce it, you should submit a bug report and someone will look into it. https://developers.facebook.com/bugs/

Azure b2c Forgot password link not woking

I'm doing xamarin-forms application with azure mobile and azure ad b2c. Everything else is working great except "Forgot your password" link.
Screenshots are from UWP client. Android client and Azure portal profile tests dont work either but give different error "You do not have permission to view this directory or page."
Is there something wrong with my sign-in/sign-up b2c policy settings or is this supposed work yet at all? All help appreciated
When you click the forgot password link on this page, B2C will redirect back to your application with an error message. The expected behavior is that the MSAL library will capture the redirect, throw an exception, which you can capture and then use to redirect to a password reset policy.
It looks like MSAL is failing to capture that redirect for some reason. Then I'd recommend opening an issue on the code sample or library you're using. But before doing so, I would double check that you're using the right redirect_uri, and capture a network trace if possible. It would be necessary to know the exact web requests that occurred during this flow, and which URL is resulting in the error message above.

reauthenticate feature has changed its behavior?

In my application to be able to switch to another user, I use the "auth_type=reauthenticate" parameter for the "https://www.facebook.com/dialog/oauth" URL. This worked for a long time. I was able to log in using other FB user than last logged. (e.g. shared PC)
Today I found out that there is no longer possible to change the user. Only re-enter password. Moreover, there is no "Cancel" button (used "dispalay=popup").
I can't find something about it on developers.facebook.com
Is anybody know something about it? Is it temporary bug or anything else?
from :
https://developers.facebook.com/docs/facebook-login/reauthentication/
Note that apps should build their own mechanisms for allowing switching between different Facebook user accounts using log out functions and should not rely upon re-authentication for this.

Facebook ios sdk 3.0 active session FBiOSSDK error2

I am getting "com.facebook.FBiOSSK error 2" error when ever try to login with my app by using device.But its working fine with the simulator.
I am using iOs SDK 3.0 Beta. any solutions?
I had the same problem on authententication with "com.facebook.sdk error 2". And i think solved it on my part. Just make sure on your app definition on "https://developers.facebook.com/apps/.."
on "IOS Bundle ID " section, that you put your app id like this com.domainname.appName and not X792739.com.domainname.appName
Yes, after you see this error, if you go to Settings, you will see that the setting for this app is turned "OFF". But the problem in this case is that the user was never prompted to allow access -- i.e. the setting was turned to OFF automatically on first time access. If the user was asked, then of course that is understandable, but this is not the case (it's as if the SDK silently and automatically pressed Don't Allow for the user). That's why this is a problem.
Before you read any further, I want to note that once the setting is set, you cannot simply repeat the process to test it, because once the setting is set, it will never ask the user (even deleting and reinstalling the app does not help). To test this issue, you need to reset the permissions by going to Settings -> General -> Reset -> Reset Location & Privacy, before you can try to replicate this again.
From testing, I've discovered that if you have offline_access in the permissions you are requesting for the first time, then it will give this login error (and not prompt the user and set the permission to OFF). The SDK does not check and tell you that this permission is not allowed; it just fails to login.
We were seeing the com.facebook.sdk error 2 error only for certain people. The problem ended up being that our Facebook App was still in Sandbox Mode. Disabling that at developers.facebook.com/apps/{ourfacebookid} instantly fixed the problem.
Turns out it was working for those of us who were set up as admins for the FB App, but not anyone else.
This error is received when the user chooses "Don't Allow" when asked to give the app permissions.
I suggest that you replace the default error message (copied from Facebook SDK sample code) with a user friendly message, telling him to make sure he granted your app the required permissions.
To fix this at iOS 6, go to Settings -> Facebook and turn your app's switch ON.
I got the same problem when I tried to follow the tutorial (http://developers.facebook.com/docs/tutorials/ios-sdk-tutorial/authenticate/)
It seems to work fine when I followed the instruction in the 'howto' section, and it's a little bit different : https://developers.facebook.com/docs/howtos/login-with-facebook-using-ios-sdk/
I faced with the same problem. It turns out that if the Sandbox is enabled than the users should be admin. If it is disabled then works for everyone.
In my case this error was the result of asking for 'publish_actions' permissions at authentication. Write permissions have to be gotten separately: https://developers.facebook.com/docs/tutorial/iossdk/upgrading-from-3.0-to-3.1/