localhost:3000に移動してfacebookボタンでログインすると、このエラーが表示されます。ブロックされたPassport.js URLがブロックされたためFacebook戦略が機能しない
URL:リダイレクトURIは、アプリケーションのクライアントのOAuth設定でホワイトリストに登録 ないため、このリダイレクトに失敗しました。クライアントと Web OAuthログインが有効になっていることを確認し、すべてのアプリドメインを有効なOAuth リダイレクトURIとして追加します。
私はFacebookを利用してログインしていないよ、と私はログインのためのFacebookに向かう取得しようとしても、私が代わりに
ログインしていません。このエラーで空白のページを取得する:あなたはそうではありませんログインして、もう一度お試しください。
はここに私の認証モジュールのindex.jsです:
'use strict';
const passport = require('passport');
const config = require('../config');
const h = require('../helpers');
const FacebookStrategy = require('passport-facebook').Strategy;
module.exports =() => {
passport.serializeUser((user, done) => {
done(null, user.id);
});
passport.deserializeUser((id, done) => {
//Find the user using the _id
h.findById(id)
.then(user => done(null, user))
.catch(error => console.log('Error when deserializing user'));
});
let authProcessor = (accessToken, refreshToken, profile, done) => {
// Find a user in the local db using profile.id
// If the user is found, return the user data using the done() method
// If the user is not found, create one in the local db and return
h.findOne(profile.id)
.then(result => {
if(result) {
done(null, result);
} else {
// Create a new user and return
h.createNewUser(profile)
.then(newChatUser => done(null, newChatUser))
.catch(error => console.log("Error when creating a new user"))
}
})
}
passport.use(new FacebookStrategy(config.fb, authProcessor));
ここに私のconfig/development.jsonファイルがあります。私はdbURIとfbのclientID &の秘密を取り出しましたが、私の開発では、これらの値は存在し、それぞれのプロバイダから入手しました。
{
"host": "http://localhost:3000",
"dbURI": "",
"sessionSecret": "catscanfly",
"fb": {
"clientID": "",
"clientSecret": "",
"calbackURL": "//localhost:3000/auth/facbeook/callback",
"profileFields": ["id", "displayName", "photos"]
}
}
私は実際に同じ問題に直面しています...しかし私は、私たちの問題はFacebookアプリケーションの設定にあると思っています。私は2分間作業してから設定を変更し、それに関連するものを見つけてここに戻ってきます。しかし、私が読んだことは間違いなく、私たちがFB appの設定で入力する必要があるサイトURLと関係しています。 – daneczech