Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

sendSignInLinkToEmail sending invalid URL

I'm trying to implement firebase's email link auth on a web app and I'm having some trouble understanding what the problem here is.

I've followed their instructions on the page to send the email and it's sending, but the problem is the URL being sent is an invalid one.

async sendAuthEmail(email) {
  var actionCodeSettings = {
    // URL you want to redirect back to. The domain (www.example.com) for this
    // URL must be whitelisted in the Firebase Console.
    url: "http://localhost:3000",
    // This must be true.
    handleCodeInApp: true,
    iOS: {
      bundleId: "com.example.ios"
    },
    android: {
      packageName: "com.example.android",
      installApp: true,
      minimumVersion: "12"
    }
  };

  return await firebase
    .auth()
    .sendSignInLinkToEmail(email, actionCodeSettings);
}

And the URL being sent is (I changed my firebaseapp name):

https://?link=https://myfirebasedbname.firebaseapp.com/__/auth/action?apiKey%3DAIzaSyDSio7vAbW7O0TVGCF2UpG7FsQDvHX0M7Q%26mode%3DsignIn%26oobCode%3DXoAsz5CoIJOhdhAcJpC2E3iWI8fmyTwJPIUmMlgLvakAAAFiy0Wm9A%26continueUrl%3Dhttp://localhost:3000&apn=com.example.android&amv=12&ibi=com.example.ios&ifl=https://myfirebasedbname.firebaseapp.com/__/auth/action?apiKey%3DAIzaSyDSio7vAbW7O0TVGCF2UpG7FsQDvHX0M7Q%26mode%3DsignIn%26oobCode%3DXoAsz5CoIJOhdhAcJpC2E3iWI8fmyTwJPIUmMlgLvakAAAFiy0Wm9A%26continueUrl%3Dhttp://localhost:3000

I also tried changing the url parameter but it fails anyway.

Any ideas that can be shared?

Thanks!

like image 685
FPJ Avatar asked Apr 15 '18 21:04

FPJ


1 Answers

Have you configured your Firebase Dynamic Link domain? You need to do that in the dynamic links section of the Firebase Console.

If you are only using this for a web only app, you don' t need to include the android or ios fields in the ActionCodeSettings object. This avoids the need to setup FDL:

var actionCodeSettings = {
  url: "http://localhost:3000",
  // This must be true.
  handleCodeInApp: true
};
like image 67
bojeil Avatar answered Oct 13 '22 21:10

bojeil