Cannot login to Facebook anymore - Access Denied
Hi,
The usual steps for Facebook login that worked for me in the past are the following:
-
STEP 1 - Issue a GET request to https://mywebAPI.apphb.com/api/Account/ExternalLogins?returnUrl=%2F... Response is something like this: /api/Account/ExternalLogin?provider=Facebook&response_type=token&client_id=self&redirect_uri=http%3A%2F%2FmywebAPI.apphb.com%3A16234%2F&state=xwxq39Q4S_kdfFdSP0l6V1SSyh5CYJH7Y5k9AvXuwUU1
-
STEP 2 - Then I prepend the hostname (https://mywebAPI.apphb.com) and issue a call to the following URL
- URL: https://mywebAPI.apphb.com/api/Account/ExternalLogin?provider=Faceb... Note: You will notice that I remove the port number (16234) from the request because it changes all the time and Facebook as part of the OAuth flow needs a consistent and real URL to redirect to
-
STEP 3 - Then Facebook sends a token into the URL that I can parse out
My issue is that step 2 is no longer working ... AppHarbor is redirecting to "http://mywebAPI.apphb.com:16234/#error=access_denied" instead of going to facebook so that I can log in.
Please assist with helping to resolve this issue, and provide any advice on what I should be doing with the port numbers.
Thanks,
Andrew
Discussions are closed to public comments.
If you need help with AppHarbor please
start a new discussion.
Keyboard shortcuts
Generic
? | Show this help |
---|---|
ESC | Blurs the current field |
Comment Form
r | Focus the comment reply box |
---|---|
^ + ↩ | Submit the comment |
You can use Command ⌘
instead of Control ^
on Mac
Support Staff 1 Posted by rune on 26 Apr, 2017 02:22 AM
Hi Andrew,
Did this problem crop up recently? I took a look at the application, and it seems that the two recent deployments occurred before you wrote earlier today, but I'd be surprised if this changed without any changes on your end -- AppHarbor doesn't really redirect requests to URLs with the port number, but your application (or a dependency/third party library) can do that if the URL generated uses the local port number which, as you mention, changes frequently.
You might be able to address the issue by following the steps in the KB article. As a first step I'd recommend adding the
aspnet:UseHostHeaderForRequestUrl
configuration variable mentioned in the beginning of the article, particularly if you're relying on a third party library. Otherwise you may have to look further into the way your application generates the URL.If that doesn't help, feel free to send over more information about where the logic responsible for that resides in your repository if you'd like me to take a closer look.
Best,
Rune
Support Staff 2 Posted by rune on 26 Apr, 2017 02:24 AM
By the way, also take a look at this recent discussion regarding a similar issue.
Best,
Rune
3 Posted by alexandrtolstoy on 30 Apr, 2017 12:50 PM
Hey Rune,
Turns out that Facebook is where the change came from ... on March 27, 2017.
I just didn't catch it till now.
http://stackoverflow.com/questions/22364442/asp-net-mvc5-owin-faceb...
But the fix is to update the Owin NuGet packages.
Thanks again for your help.
Andrew
Support Staff 4 Posted by rune on 01 May, 2017 02:02 AM
Hi Andrew,
Ok great, glad you figured it out and thanks for the heads up!
Best,
Rune
rune closed this discussion on 01 May, 2017 02:02 AM.