Firebase sendSignInLinkToEmail with Custom SMTP does not work - ios

When using passwordless signin across any SDK (I'm using JS-web version 8 and iOS/Android with react-native-firebase) the link that is generated does not use the link url in the action settings if you've configured custom SMTP settings for email templates with a custom domain.
My custom domain for example is prod.fun.stuff and is already setup with Firebase Hosting and I've added it for the email templates as well.
When you use the sendSignInLinkToEmail method, you pass it an action code settings object. Here's an example of what I'm using:
const actionCodeSettings = {
url: 'https://prod.fun.stuff/links/confirmEmail',
handleCodeInApp: true,
iOS: {
bundleId: 'com.stuff.fun'
},
android: {
packageName: 'com.stuff.fun'
},
dynamicLinkDomain: 'prod.fun.stuff'
}
In my iOS app I've configured Universal Links properly to handle links in the app that use this domain:
# fun.entitlements
applinks:prod.fun.stuff
I use Mailgun as my email service and have configured its SMTP server settings for my domain mg.fun.stuff to send all my emails. While enabled, the login link is actually sent with:
http://email.mg.fun.stuff/e/someCrazyEncodedString...
What's unexpected is the login link is not the same domain as the actionCodeSettings I passed sendSignInLinkToEmail, and also that the protocol is http instead of https
but if I disable the custom SMTP server the login link that is sent to users is actually more intelligible:
https://prod.fun.stuff/?link=https://fun-stuff.firebaseapp.com/__/auth/action?apiKey%3DgeneratedAPIKey%26mode%3DsignIn%26oobCode%3DgeneratedoobCode%26continueUrl%3Dhttps://prod.fun.stuff/links/confirmEmail%26lang%3Den&apn=com.stuff.fun&amv=1&ibi=com.stuff.fun&ifl=https://fun-stuff.firebaseapp.com/__/auth/action?apiKey%3DgeneratedAPIKey%26mode%3DsignIn%26oobCode%3DgeneratedoobCodeQ%26continueUrl%3Dhttps://prod.stuff.fun/links/confirmEmail%26lang%3Den
It seems that with a custom SMTP server Firebase auth the login link has to be handled and decrypted by the custom server before it returns the proper redirect urls which can be handled.
This is an issue because when the user clicks on the link it doesn't get handled by the app, it instead opens the phone's browser.
Here are my Firebase SMTP settings:
Is there something I've possibly configured wrong with my email server? Or is this expected behavior when using a custom SMTP server? Should I handle the email server CNAME as another Universal link in the app?

Related

Verify email on appwrite (my docker container) without mobile

var result = await account.createVerification (url:'http://192.168.20.49:81/v1/account/verfication' );
sends a link to the mail
(http://192.168.20.49:81/v1/account/verfication?userId=63972f2f56d0c39fc9f8&secret=5025d...a&expire=2022-12-20+12%3A08%3A11.784)
Redirects to the browser and in the browser window json
{"$id":"6396bde6604188965bab","$createdAt":"2022-12-12T05:36:38.796+00:00","$updatedAt":"2022-12-12T15:44:11.741+00:00","name":"Andrey","registration":"2022-12-12T05:36:38.795+00:00","status":true,"passwordUpdate":"2022-12-12T15:44:11.741+00:00","email":"andrey253#yandex.ru","phone":"","emailVerification":true,"phoneVerification":false,"prefs":{}}
how to make sure that mail on the site is verified without redirection to the mobile? Can I create a page on the site for verification? And why verification does not happen automatically when clicking on the link, it would be very convenient!
For me a problem to receive in the userId and secret application in flutter from url http://192.168.20.49:81/v1/account/verfication? userId=63972f2f56d0c39fc9f8&secret=3ab63c4dee.41&expire=2022-12-20+19%3A42%3A10.896.
Instead of passing http://192.168.20.49:81/v1/account/verfication, you'll need to pass a URL to some page or something that will receive the secret so you can make the update verification API call. You can either host a web page to do it or set up a universal link that will link the user into your app where you can handle it in your app.

Firebase Phone Authentication Using Multiple Authentication Providers

Introduction
We've been having trouble using Firebase Auth configured with multiple authentication providers.
The documentation specifies that an application can support multiple firebase projects.
Email Sign In
We have been able to successfully configure our application so that email authentication works with multiple authentication providers.
For example:
// Configure secondary app
FirebaseApp.configure(name: "SecondaryAuth", options: options)
// Retrieve newly created app
guard let secondaryApp = FirebaseApp.app(name: "SecondaryAuth") else { return }
// Retrieve an Auth client configured against newly created app
let secondaryAuth = Auth.auth(app: secondaryApp)
So calling secondaryAuth.signIn(withEmail: …, password: …) is successful and works just fine.
Phone Sign In
The problem we are facing is related to phone authentication.
We have noticed that PhoneAuthProvider’s initializer can take in an Auth parameter, which leads us to believe that phone authentication should work using different authentication providers.
The documentation specifies that for phone authentication to work we must:
Enable phone number sign in on our Firebase projects
Enable app verification using:
Silent Push Notifications
reCAPTCHA
We have enabled these requirements and our app’s Firebase projects all support:
Phone number sign in
Have properly configured APNS
Xcode project has correctly configured URL Schemes
The problem we are facing is that after we call verifyPhoneNumber by passing the PhoneAuthProvider a secondary auth like so:
PhoneAuthProvider.provider(auth: secondaryAuth).verifyPhoneNumber(..., uiDelegate: nil)
We are receiving this error message:
'Please register custom URL scheme 'app-1-...' in the app's Info.plist file.'
Keep in mind that we have specified the proper URL Scheme pertaining to the secondaryApp previously mentioned inside the app’s info.plist.

react-native auth0 sign in with apple?

How to sign in with apple in react-native using auth0 web form authentication?
Tried following this guide: https://auth0.com/docs/connections/apple-siwa/set-up-apple?_ga=2.267694410.553381554.1591475612-866095660.1584309547
But no luck. Testing the connection gives me: invalid_redirect_uri.
One problem with guide was this part about creating service id:
"After checking Sign In with Apple, click on Configure and define your Web Domain (example.com) and your Return URL. Make sure that your Return URL is your Auth0 domain, such as foo.auth0.com (or your Auth0 custom domain if you have one) and follows this format: https://YOUR_AUTH0_DOMAIN/login/callback. "
Since I use react-native, the callback is not an url that starts with 'https', but a custom uri to return users back to the application. Apple won't allow me to put that custom uri when creating the service-id, but requires the https prefix.
Has anyone succeeded in implementing sign in with apple for react-native applying the auth0 web authentication? Any help is appreciated.
Just as I decided to ask, I got this solved.
Problem was that I was just copy-pasteing the login callback from my auth0 app's configuration directly. Instead of actually doing what reads in the guide.
So I changed the login callback to just follow this format: https://YOUR_AUTH0_DOMAIN/login/callback
And it works now.

Mandrill Inbound email- setting up Sending Domains with an app hosted on Heroku

I am trying to learn the ins and outs of Mandrill, so I created a test app that has no functionality except creating users, signing them in and out, and clicking on a link that sends the user an e-mail through ActionMailer.
So far all of this works fine. I have configured Mandrill to send e-mail in both development and production (Heroku). What I'm trying to do now is configure it to receive e-mails sent from users and do stuff with them. My problem is that I'm not sure what to add as my mail domain in the Sending Domains section of my Mandrill account page.
I've done this before with an app on Heroku using Mailgun. Mailgun gave me a Mailgun subdomain to use for user testing off the bat (app12345678.mailgun.org). I was able to send mail to postmaster#app12345678.mailgun.org and it worked perfectly. With Mandrill it's proven a bit more difficult.
Mandrill doesn't seem to provide a Mandrill subdomain to start with. I suppose my question is: is it at all possible to get a Mandrill subdomain for testing like the one Mailgun provides? If not, how can I go about user testing inbound e-mail with Mandrill if I don't currently own my own custom domain? What can I use as the Sending Domain?
it's not currently possible to use Mandrill's inbound email routing unless you have a domain/subdomain to work with. We don't provide a testing subdomain to use for inbound routing.
Any domains you actually send from in Mandrill will be added to the Sending Domains page. You don't have to manually enter any domains there, since we'll detect any that you use and show them there automatically. If you want to set up SPF and DKIM for your sending domain, you can manually add it in order to validate the records have been added correctly.
If you have other questions specific to your account, our support team is also happy to help if you want to get in touch via the Support button in your account.

How can I add localhost:3000 to Facebook App for development

I am working on a Rails 4 app. On my laptop, development is done at localhost:3000. The actual domain of the site is roomidex.com.
How can I set up a Facebook app so it works on production and development?
Here is the current configuration:
App Domains: roomidex.com
Website With Facebook Login:
Site URL: http://www.roomidex.com
When I try to do a Facebook login on localhost:3000, I get this not surprising error:
{
"error": {
"message": "Invalid redirect_uri: Given URL is not allowed by the Application configuration.",
"type": "OAuthException",
"code": 191
}
}
On the Facebook App page, click "edit App" then click "Advanced" in the left-hand navigation. Then for "Valid OAuth redirect URIs" add http://localhost:3000... or whatever you want the accepted redirect to be.
You can create a test app that's connected to your main app. On the Dashboard or Settings page for your main app. scroll down and you'll see "Test Apps" in the menu that runs down the left side of the page. The test app will inherit settings from the main app, but it will permanently be in development mode, and it will have its own ID.
More info on test apps here:
https://developers.facebook.com/docs/apps/test-apps/
The protocol for setting up an app to work on localhost has changed. After you get your test app set up, this explains the steps for setting it up to work on localhost:
https://stackoverflow.com/a/24253054/2803458
Your error is saying
localhost URL is not allowed in the application
I know, FB does not give a s**t about explaining, what do to in those moments, however, as far as I am concerned, I have found workaround.
Basically, you need to "whitelist" locahost url in your app
Here is what you are going to do
Go to the app edit/summary page
In the fourth field App Domains, you should already have roomidex.com, so add another address localhost
The urls mentioned above are only valid, if each one of them is put into tabs, where you set, how you app integrates with Facebook (website with facebook login, App on facebook, Mobile web, …)
I do this: I put my working URL, in your case roomidex.com into Website with facebook login, and my test, localhost URL, either into App on facebook or Page tab
June 2015
Go to My Apps > Settings > Basic
App Domains
localhost
Site Web
URL : http://localhost:8888/
Mobile URL : http://localhost:8888/
It didn't work with port 80 or without any port unfortunately.
Adding localhost to the Valid OAuth redirect URIs in the test app did not work for me but adding 127.0.0.1 did.
Facebook now requires "Valid OAuth redirect URIs" to be https.
To use https locally (localhost:3000), I used [ngrok][1] which allows you to use https by providing a tunnel. To do this:
I went to their website and downloaded their program
I extracted the file for the program
In my console, I went into the directory where ngrok was extracted to and entered 'grok http 3000' on my Windows machine, others may use './grok http 3000'
After entering that, ngrok provided a https address which I put into the Valid OAuth Redirect URIs field in Facebook
Then I started my server and was able to access it using that https address instead of localhost:3000
Just create two applications.
One for testing and one for release. You cannot supply the app with separate URL configurations.
Just edit your hosts file with your domain that pointing to localhost and it should work fine.

Resources