Meteor OAuth callback URL problems with custom domain on Heroku

TLDR; I have this exact problem

Long Version
I have setup custom domain on heroku for my app.
Usually user visits my domain www.foo.com and clicks “Sign in with Google”

  1. Google authenticates and calls back to www.foo.com/_oauth/google?close
  2. The popup closes and the user is now authenticated on www.foo.com.

Problem:
Instead, at step 2, Google is calling back to foo.herokuapp.com/_oauth/google?close. The upshot is I can’t log in at www.foo.com. I can go to foo.herokuapp.com and that works properly.

Tried
As mentioned in the answer from above link, I tried to set ROOT_URL with Meteor.absoluteUrl('http://www.foo.com'); on server’s startup method but still no luck!

Any help? Thanks in Advance.

Figured out a workaround. I manually changed the ROOT_URL value from console to foo.com. Earlier it was foo.herokuapp.com

p.s: yes, now the login functionality on foo.herokuapp.com is broken!