繁体   English   中英

在本机iOS应用程序中使用PassportJS和Nodejs遇到错误“ redirect_uri URL必须是绝对的”

[英]Getting error “The redirect_uri URL must be absolute” using PassportJS and Nodejs in native iOS application

我将PassportJS与Node和Express一起使用。 我是在本机iOS应用程序中执行此操作的。 当我通过Node到Facebook启动基于API的身份验证时,我获得了到Facebook的重定向URL,并且当我尝试将其加载到Web视图中时,我收到一条错误消息:“ redirect_uri URL必须是绝对的。”

这个专案没有网站,只有一个应用程式,所以我在回呼网址中指定深层连结

//setup facebook authentication
passport.use(new FacebookStrategy({
    clientID: "13434543",
    clientSecret: "fdaf323432fadfa134",
    callbackURL: "sixdwf://deeplink?facebook=/auth/facebook/callback"
  },
  function(accessToken, refreshToken, profile, done) {
    User.findOrCreate(accessToken, refreshToken, profile, done, function(err, user) {
      if (err) { return done(err); }
      done(null, user);
    });
  }
));

// Redirect the user to Facebook for authentication.  When complete,
// Facebook will redirect the user back to the application at
//     /auth/facebook/callback
app.get('/auth/facebook', passport.authenticate('facebook', { scope: ['public_profile', 'email' , 'user_friends'] }));

// Facebook will redirect the user to this URL after approval.  Finish the
// authentication process by attempting to obtain an access token.  If
// access was granted, the user will be logged in.  Otherwise,
// authentication has failed.
app.get('/auth/facebook/callback', 
  passport.authenticate('facebook', { successRedirect: '/',
                                      failureRedirect: '/login' }));

// app.post("/account/login", function(req,res)
// {
//  actMgr.handleLogin(req,res);
// });

知道如何克服这个吗?

给绝对回调URL类似

www.mytestOauth.com/auth/twitter/callback

装的

sixdwf://deeplink?facebook=/auth/facebook/callback

我也遇到同样的问题,它的工作原理

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM