program tip

Facebook 로그인 메시지 : "URL 차단됨 : 리디렉션 URI가 앱의 클라이언트 OAuth 설정에 허용되지 않기 때문에이 리디렉션에 실패했습니다."

radiobox 2020. 8. 4. 07:37
반응형

Facebook 로그인 메시지 : "URL 차단됨 : 리디렉션 URI가 앱의 클라이언트 OAuth 설정에 허용되지 않기 때문에이 리디렉션에 실패했습니다."


중요 공지 :

테스트를 위해 등록하는 경우 프로파일 설정으로 이동하여 관심사프로파일 삭제를 추가 하십시오 .

Facebook으로 내 웹 사이트 에 로그인하려고합니다 .

다음과 같은 오류가 발생합니다.

URL 차단됨 : 리디렉션 URI가 앱의 클라이언트 OAuth 설정에 허용 목록에 없으므로이 리디렉션에 실패했습니다. 클라이언트 및 웹 OAuth 로그인이 켜져 있는지 확인하고 모든 앱 도메인을 유효한 OAuth 리디렉션 URI로 추가하십시오.

settingsFacebook의 (기본)은 다음과 같습니다.

고급 탭에서 다음 Valid OAuth redirect URIs으로 설정됩니다.

http://openstrategynetwork.com/_oauth/facebook?close

앱은 public입니다.

더 많은 설정 (고급) : 여기에 이미지 설명을 입력하십시오

앱 키와 비밀이 맞습니다. Meteor와 해당 계정 패키지를 사용하고 있습니다.


귀하의 사이트에서 Facebook으로 로그인 버튼이 연결되어 있습니다 :

https://www.facebook.com/v2.2/dialog/oauth?client_id=1500708243571026&redirect_uri=http://openstrategynetwork.com/_oauth/facebook&display=popup&scope=email&state=eyJsb2dpblN0eWxlIjoicG9wdXAiLCJjcmVkZW50aWFsVG9rZW4iOiIwSXhEU05XamJjU0VaQWdqcmF6SXdOUWRuRFozXzc0X19lbVhGWUJTZGNYIiwiaXNDb3Jkb3ZhIjpmYWxzZX0=

주의: redirect_uri=http://openstrategynetwork.com/_oauth/facebook

대신 링크를 다음으로 변경하십시오.

redirect_uri=http://openstrategynetwork.com/_oauth/facebook?close

작동해야합니다. 또는 Facebook 링크를 다음으로 변경할 수 있습니다.http://openstrategynetwork.com/_oauth/facebook

http://localhost/_oauth/facebook유효한 리디렉션 URI에 추가 할 수도 있습니다 .

Facebook에서는 리디렉션 URI를 허용해야합니다. 그렇지 않으면 사람들이 서비스를 위해 Facebook으로 로그인 한 다음 액세스 토큰을 공격자의 서버로 보낼 수 있기 때문입니다! 그리고 당신은 그런 일이 일어나기를 원하지 않습니다.]


질문자가 쓴대로

고급 탭에서 유효한 OAuth 리디렉션 URI는 다음으로 설정됩니다. ...

동일한 문제가 발생했습니다 (리디렉션 URL을 잘못된 입력 필드에 쓰는 중).

아닙니다

Settings -> Advanced -> Share Redirect Whitelist

그러나

Facebook Login -> Settings -> Valid OAuth redirect URIs

그것은 2 시간의 시행 착오를 저장했을 것입니다.

또한와 www.example.com같지 않다는 점을 명심해야합니다 example.com. 리디렉션 URL에 두 형식을 모두 추가하십시오.


이것은 나를 위해 일했습니다.

redierct_url = http://127.0.0.1:8080/accounts/facebook/login/callback/

Facebook 버튼을 클릭하면 브라우저에서 Facebook 브라우저와 통합 할 수있는 링크로 리디렉션되므로 리디렉션을 얻을 수 있습니다. 내 경우에는 링크가 redirect_url을 얻은 위치에서 얻은 것입니다.

https://www.facebook.com/dialog/oauth?client_id=...&scope=&response_type=code&state=...&redirect_uri=http://127.0.0.1:8080/accounts/facebook/login/callback/

여기에 이미지 설명을 입력하십시오 여기에 이미지 설명을 입력하십시오


Make sure "App Domain" and Facebook Login => Valid OAuth redirect URIs. There you must check www or without www. Its better if you use with www or without for all URLs in php,html,css files and Fb app settings.

Other thing is if you're using "/" end of the URLs you must add that URL to app settings of Valid OAuth redirect URIs. Example:- https://www.example.com/index.php/ if this url if youre using in the redirect url you must set that to app settings.

Hope this would be help.


For my Node Application,

"facebook": {
        "clientID" : "##############",
        "clientSecret": "####################",
        "callbackURL": "/auth/facebook/callback/"
    }

put callback Url relative

My OAuth redirect URIs as follows

여기에 이미지 설명을 입력하십시오

Make Sure "/" at the end of Facebook auth redirect URI

These setups worked for me.


Changing from hauth.done=Facebook to hauth_done=Facebook in the Valid OAuth redirect URIs fixed it for me.


In my case, I just had to make sure I have my urls both with and without www for Application Domain and Redirect URLs:

여기에 이미지 설명을 입력하십시오

In my case, I had to use: signin-facebook after my site url, for redirect url.


Ok First of all this is a very clear error message. Just look at this many devs miss this including my self. Have a look at the screen shot here please.

여기에 이미지 설명을 입력하십시오

Under Products > Facebook Login > Settings

or just go to this url here (Replace YOUR_APP_ID with your app id lol):

https://developers.facebook.com/apps/YOUR_APP_ID/fb-login/settings/

If you are working on localhost:3000 Make sure you have https://localhost:3000/auth/facebook/callback

Ofcourse you don't have to have the status live (Green Switch on top right corner) but in my case, I am deploying to heroku now and will soon replace localhost:3000 with https://myapp.herokuapp.com/auth/facebook/callback

Of course I will update the urls in Settings/Basic & Settings/Advanced and also add a privacy policy url in the basic section.

I am assuming that you have properly configured initializers/devise.rb if you are using devise and you have the proper facebook gem 'omniauth-facebook', '~> 4.0' gem installed and gem 'omniauth', '~> 1.6', and you have the necessary columns in your users table such as uid, image, and provider. That's it.


Try to add http://openstrategynetwork.com/sigin-facebook to Client OAuth Settings valid redirect URL along with your own redirect URL.


Login Helper of your site

$loginUrl = $helper->getLoginUrl('xyz.com/user_by_facebook/', $permissions);

and in facebook application dashboard (Under products tab : Facebook Login )

Valid OAuth redirect URIs should also be same to xyz.com/user_by_facebook/

as mentioned earlier while making request from web


We had the same problem, such a nightmare.

  1. Make sure your App IDs and Secret Keys are correct. If you are using separate development, staging and production apps for testing, the App IDs and Secret Keys are all different for each app. This is often the problem.

  2. Make sure you have the callback URL set properly in your app config file (see below). And then add this as same URL under "Facebook Login" settings where it says "Valid OAuth redirect URIs". It should look like this (depending on your environment):

http://localhost/auth/facebook/callback http://staging.example.com/auth/facebook/callback http://example.com/auth/facebook/callback

  1. Make sure your app domain is set to the correct domain for each environment, including both "www" and "no-www". Facebook also requires these domains to match the URL of your website or app platform. You will have to select "Add Platform" to add this.

In my case, I was integrating Facebook login within a Rails app tutorial. I had added http://localhost:3000/adsf to my Valid OAuth Redirect URIs, but the Rails app would open the url as http://0.0.0.0:3000 and would therefore try to redirect to http://0.0.0.0:3000/asdf. After adding http://0.0.0.0:3000/asdf to the Valid OAuth Redirect URIs, or navigating to http://localhost:3000/asdf, it worked as expected.


In my case URI, as it was defined on FB, was fine, but I was using Spring Security and it was adding ;jsessionid=0B9A5E71DAA32A01A3CD351E6CA1FCDD to my URI so, it caused the mismatching.

https://m.facebook.com/v2.5/dialog/oauth?client_id=your-fb-id-code&response_type=code&redirect_uri=https://localizator.org/auth/facebook;jsessionid=0B9A5E71DAA32A01A3CD351E6CA1FCDD&scope=email&state=b180578a-007b-48bc-bd81-4b08c6989e18

URL 재 작성을 피하기 위해 다음 과 같은 방법으로 disable-url-rewriting = "true" 를 Spring Security 구성에 추가했습니다.

<http auto-config="true" access-denied-page="/security/accessDenied" use-expressions="true"
      disable-url-rewriting="true" entry-point-ref="authenticationEntryPoint"/> 

그리고 그것은 내 문제를 해결했습니다.

참고 URL : https://stackoverflow.com/questions/37001004/facebook-login-message-url-blocked-this-redirect-failed-because-the-redirect

반응형