Pass firebase auth credentials from ionic app to external website - firebase

I have an ionic app using firebase auth. In one page, I have in-app-browser to open a website which allows the user to save some items to their collection. How can I pass along the auth info to this external website, so the user doesn't need to log in again? (i.e. how the external website knows it's the same user who has already login within the ionic app)

Related

Firebase Third Party Account Linking

Im currently trying to build a web app using firebase and am fairly new to web development. I currently am using SvelteKit and am only allowing users to sign in via email authentication with Firebase Auth. I was curious to if there was a more efficient method of account linking than what I am currently doing
I currently have users:
Click Link Discord button
User Authorizes with Discord
I store user discord info in their user document in Firestore
The problem I see with this is that if the users change their account info on discord that it will not be reflected in my app.
Should I be storing the tokens in a cookie and calling them? would that be also bad as the tokens expire?

Azure B2C Login on Xamarin forms app with Face/TouchId/Fingerprint/Keychain integration with API

We are using Azure B2C for login/authentication of our users. This works fine on our website (social and email login etc).
Our mobile app is built in Xamarin forms and we are trying to build a native login experience (using native app controls vs. a web view within the app that B2C presents) that integrates natively with the device biometrics for login (FaceId, TouchId, fingerprint login).
As you can imagine, doing this in the webview that Azure B2C requires doesn't allow a native login experience.
The overall goal here is 2 fold:
Build a native login experience
Integrate with biometrics.
Question:
Does Azure B2C have an API that enables this, especially so we can use authorization code flow without a UI. ROPC exists but does it integrate with social accounts too?
If not, is there a way to integrate biometric login with Azure B2C on mobile when the login screen is presented in a webview? So that when the B2C login page in the webview is presented, a user can login with touch/faceId and save that information to they keychain (on iOS and the equivalent on Android)
You need to use Webviews, and you can enable Biometric integration with webview type experience.
You cannot integrate any service with Social Accounts and ROPC. Any integration with Social IdPs will need a webview.
Yes, enable Keep Me Signed In for long lived sessions. Wrap the biometric code around the acquireTokenSilent() methods.
Then you have two options:
You can hide the KMSI button, and use JavaScript to force select the KMSI checkbox in the login page using page customisation.
You can rename the KMSI label on the login page to ask the user if they want to enrol in to biometric. Then after the login, your app will receive a claim in the token whether the user opted in, use claim resolver to achieve that.
Now you have a user logged into the App, with:
1 hour access token
Potentially up to infinity long refresh token
Multi day/year Azure AD B2C session cookie
Then, when the user re-attempts to open the app, or perform some action in the app, you will need to call acquireTokenSilent(). This MSAL method obtains a fresh access token for the required API resource/scope.
If the token is expired, or requires a different scope, the a new token is fetched.
You can wrap any action in your application with the biometric SDK.
if (performingSomeAction && requiresBiometric)
if (challengeBiometric succeeds)
acquireTokenSilent()
//do someAction
Now if the refresh token has expired, then the web view will pop up, the long lived session cookie will be used to get new tokens. The acquireTokenSilent() method handles all of that already.

Flutter app login issues | creates new account with FB or Gmail login, but wont recognize original account created

I am having some login issues with my app, Hallo. The issue is if you create an account either through Facebook or google login, but then decide to delete the app, when reinstall the app and log back in, it does not recognize the original account you logged-in with.
Another problem is that sometimes, when you login with Facebook to the Hallo app, it will login to a different account you are not signed in to currently via the facebook app. (i have 2 accounts on Facebook).
I have tried to make sure I was logged in with the correct account, even loggedin with FB messenger, but that does not make a difference. Deleting the app and trying again, no difference.
We are using flutter and firebase, flutter plugin for FB login.
The original account exists as well, but no way to access it via login... It works from logining in to the account from another phone, but not phone the account was set up on.

Firebase Android+WebApp. How to Pass Auth from Android App to JavaScript in Webview

Have an authenticated Firebase User in my Android App. Webview in the same Android App which loads a HTML page, need to access the Firebase DB via Javascript.
For the Webview to access the Firebase DB, need to authenticate again in the javascript. I can use signInWithCustomToken(), but Android App can't create custom token, have to call Server every time to create CustomToken and pass it to webview.
Is there any way I could pass Authentication From Android App to Webview inside that?

Firebase disable automatic login account creation

I am building a web and mobile app using firebase. When signing with Google, firebase auto creates a new account in the project (Auth) if one does not exist. Its fine with the mobile app.
But with the web, I just want existing users (who created accounts with mobile app) to signin and not create new accounts via web.
How do I setup firebase not to create new accounts if one does not exist?
There isn't a way to restrict social sign-in with Firebase Auth to "only sign in, not sign up".
If you have a means of detecting users that have signed in using the app at some point (e.g. by writing a value to your database in a specific location), you could check for that value when signing in via the web, and, if missing, display a screen encouraging users to install the mobile app.
I think this is what you are looking for:
Link Multiple Auth Providers to an Account Using
JavaScript
You can allow users to sign in to your app using multiple
authentication providers by linking auth provider credentials to an
existing user account. Users are identifiable by the same Firebase
user ID regardless of the authentication provider they used to sign
in. For example, a user who signed in with a password can link a
Google account and sign in with either method in the future. Or, an
anonymous user can link a Facebook account and then, later, sign in
with Facebook to continue using your app.

Resources