I recently deployed a website on Heroku and bought a domain name through OVH.
To link my custom domain to my Heroku app, I followed Heroku's doc here: https://devcenter.heroku.com/articles/custom-domains#add-a-custom-domain-with-a-subdomain
Everything works smoothly, I can access my website using my custom domain name.
The only issue is when I'm sharing a link from my website on Facebook, it shows the link to the heroku app in the preview: https://example.com/test becomes https://example.herokuapp.com in the preview.
Any ideas why?
Just in case anyone runs into the same type of issue, the link given by WizKid is super helpful: https://developers.facebook.com/tools/debug/
For me, the issue was an og:url tag that was set directly in Heroku through a CANONICAL_ROOT_URL config var.
Related
Using Visual Studio 2013 Update 5, I have created a boilerplate MVC 5 application with Individual User Accounts auth option selected, and I have been trying to implement social logins using the template code, but have been unsuccessful.
I have ensured all NuGet packages are up to date, and the code is using MVC 5.2.3; Owin 3.0.1; AspNet.Identity 2.0.0.
I can get everything working fine, including authenticator apps using OtpSharp, but the Facebook login is just not working whatever I try.
I have created the Facebook App, set all the relevant options on that and set the AppId and AppSecret in my Startup.Auth.cs file.
When I try to login with Facebook, the MVC site redirects me to Facebook, which prompts me with the auth screen for the app. I click OK and accept this then I am redirected back to the MVC app. If I check the authorised apps under my Facebook account, my app is listed and shows that it has granted permission to the app to retrieve email address.
The callback works fine but when it hits ExternalLoginCallback and in particular:
var loginInfo = await AuthenticationManager.GetExternalLoginInfoAsync()
loginInfo always returns null.
Looking at the Request it shows an error of access_denied:
https://localhost:44301/Account/ExternalLoginCallback?ReturnUrl=%2Fmanage&error=access_denied
I have read pretty much every blog post and SO question on this error and whilst most of them are helpful, most are also out of date and not relevant.
It would seem that something is missing from the templated project, or something has changed elsewhere as no matter which tutorial I read, and options I set, the result is the same.
I have tried this internally on a dev machine running IIS Express and externally on a hosted machine running IIS 7.5 too and the results are the same.
I've even decompiled the Microsoft.Owin.Security.Facebook library to see where that particular section of the querystring is set to no help.
If I had any hair I'd have pulled it all out by now.
I'll take any suggestions. Can anyone help?
Facebook loves to make things difficult. Access_denied sounds like they are blocking you on purpose. Check your developer dashboard and the accounts authorized to test your app while its in development mode. The email permission is approved by default, so that isn't your issue.
Make sure the account you are testing with is added here:
If that doesnt solve it, make sure you have the correct app domains (testing and live) listed in the domain section here:
I had the exact same issue. No matter what I did the facebook would show the login, get permissions and then return back to the Login page instead of the Email confirmation page.
Using Fiddler Facebook would invoke "http://localhost:1234/signin-facebook&code=SOME_SECRET_CODE_HERE", and then my application's controller would invoke "http://localhost:1234/ExternalLoginCallback?error=access_denied". I was sure Facebook is refusing the access. It was only after implementing a Facebook Javascript SDK Sample, I realised I could successfully login and also view FB scopes!
My Dev environment
MVC 5 application
Visual Studio 2013 Community edition Update 5
Microsoft.OWIN v2.2.1
Microsoft.OWIN.Security.Facebook v3.0.1
Finally I found a YouTube Video by ProCoder which mentioned to put the correct path in the Valid OAuth redirect URIs as http://localhost:1234/signin-facebook and it worked. If you haven't already added, you will need to add Facebook Login product to your Facebook app.
I also set App Domain to localhost and Site URL to http://localhost:1234/
I have added 127.0.0.1 and MY.EXTERNAL.PUBLIC.IP to the Server IP Whitelist Under Security in the Advanced Settings option of the Facebook app.
All these settings I replicated in a new MVC 5 application and it worked like a charm.
update the package Owin.Security.Facebook 3.0.1 to 3.1.0
It works for me
my Facebook Login worked for everything before, from locahost to .meteor.com, and also when I deployed it to modulus (.onmodulus.net). I had to reconfigure the keys each time of course. But now I bought a domain name at Gandi.net (jamscope.in) So now when I go to jamscope.in it opens the .onmodulus.net site. Now the facebook login no longer works and gives me no error either. I tried reconfiguring the facebook bit to both jamscope.in, and then back to http://jamscope-21300.onmodulus.net/, but neither works. I don't know what to do since I have no experience with linking domain names. What can I do?
CLARIFY:
I deployed my site on .onmodulus.net, and then bought a new domain name (jamscope.in) for it, now when I login at jamscope.in, the facebook popup is blank, and the URL of that popup is (https://www.facebook.com/dialog/oauth?client_id=544143532381792&redirect_uri=http://jamscope-21300.onmodulus.net/_oauth/facebook?close&display=popup&scope=email&state=8syVowrx8t1R8srHiXG6T_TjF3MyN9sbFKO_9HAqkNR)
It still refers to the old domain name>
I tried reconfiguring the facebook developer part but none if it worked
You need to set meteors ROOT_URL
which comes from the environment variable of the same name
all:
We have a software developer building a web site with Facebook login for our company. They have told us to register a Facebook application.
For the moment, the beta application is hosted in a development environment. I would like to start testing also the Facebook integration. But when I access to the application page in Facebook, I get an error.
I think it might be related to an attribute I find in the first page of the app configuration. The attribute is called "Hosting URL".
The option seems to be linked to some kind of hosting service provided by Heroku. I don't know exactly what is that, but I would say we do not need it. We will use our own hosting server and, what's more, our application is developed in a language different that the one Heroku supports.
Could somebody confirm us which is the problem and, if it is possible, give us a hint to solve it?
Thank a lot in advance,
-The SportPoket team
The "Hosting URL" is meant to be the public web address of your finished production application. During development however, you only need to provide the URL for the app that is accessible from your web browser. If you are running a local web server on port 5000, http://127.0.0.1:5000/ will work.
Heroku is just one of the suggested hosting services for Facebook and you don't have to use it, but the documentation can be helpful. More about setting up a Facebook app dev env can be found here: https://devcenter.heroku.com/articles/facebook#1-creating-a-development-facebook-app
I'm trying to add facebook connect to my online mafia game that I own.
When trying to add my domain name I get this:
Error
App Domain: http://www.redhotglockz.com/ is not a valid domain.
It is valid cause I am logged in right now, the site is working fine.
I had to pay money to add this to my site, after purchase I go into my site control panel and into the newly available facebook connect option. It gave me an app name and game url and a link to facebook to create a new app. I followed this link and added the info as instructed, and result was invalid domain name. I used copy and paste to enter info. And url shown is correct.
Any idea how i can fix this?
thank you in advance.
i figured out my problem...
i was posting app domain as www.ReDHoTGLoCKz.com
facebook wouldn't accept it using caps.
it worked using www.redhotglockz.com
thanks for your responses!
check your facebook app configuration at https://developers.facebook.com/apps . make sure in basic setting, you set your App Domain with your url.
That's not a domain, that's a URL.
Enter just redhotglockz.com and it should work fine.
I'm working on a new website that uses the Facebook API for users to login and several implementations of the graph Api.
My workflow usually is:
Development on localhost
Development using MAMP/XAMPP or similar software
Push to server -> testing domain
A team of people can test the changes for a few days to see if everything works as planned.
Push to server -> live domain
Changes are live for public
Facebook uses the site URL in the appsettings and for security reasons, they will only redirect to that url... Problem is.. I have localhost and 2 different domains. How can I make this work?
Of course I could edit the hostsfile, but that only fixes it for localhost.. Still no solution for the testdomain.
Please tell me this is somehow possible! I'm getting more and more depressed with the Facebook API.
I usually register a facebook app per environment. (dev points to localhost etc..)
Haven't found a nicer way to do this either..
why still test facebook api on localhost?
You can try in heroku
This is
facebook official blog article
Also see the document in heroku
It is free to use.