标签: facebook-authentication

如何阅读facebook signed_request来获取user_id

根据Facebook - Canvas页面文档中的身份验证,他们说我们将获得一个signed_request包含JSON对象的内容.现在他们说signed_request可以通过$_POST['signed_request']我同意它为我工作.

现在根据他们如果用户登录我将获得这样的JSON对象值: -

{
  "expires":UNIXTIME_WHEN_ACCESS_TOKEN_EXPIRES,
  "algorithm":"HMAC-SHA256",
  "issued_at":UNIXTIME_WHEN_REQUEST_WAS_ISSUED,
  "oauth_token":"USER_ACCESS_TOKEN",
  "user_id":"USER_ID",
  "user":{
    "country":"ISO_COUNTRY_CODE",
    "locale":"ISO_LOCALE_CODE",
    ...
  }
}
Run Code Online (Sandbox Code Playgroud)

现在我想取出user_id这个,所以我使用这段代码,但它不工作: -

if(isset($_POST['signed_request']))
{
    echo 'YES';
    $json = $_POST['signed_request'];
    $obj = json_decode($json);
    print $obj->{'user_id'};    
}
Run Code Online (Sandbox Code Playgroud)

它只是打印出来的YES.为什么会这样?

我已经阅读过某个地方,如果没有应用程序身份验证,我将无法提取user_id但是根据facebook,这是第一步,验证应用程序将是第4步.我是新手,如果有人能帮助我,那将会有很大的帮助.谢谢.

php facebook facebook-authentication facebook-canvas facebook-app-requests

5
推荐指数
2
解决办法
2万
查看次数

如何在没有登录对话框页面的情况下验证facebook sdk?

我正在使用Facebook SDK在我自己的Facebook页面上发布一些测试墙帖子.我想要的是每隔8小时使用PHP CRON脚本在我的Facebook页面上发布,为此我必须绕过Facebook登录对话框页面,那么有人知道从命令行或播出进行身份验证的方式吗?

php cron facebook facebook-authentication

5
推荐指数
1
解决办法
5085
查看次数

Django Angular Facebook身份验证

我想做一个非常简单的网络应用程序,你可以使用你的Facebook帐户登录.

我对django框架非常满意angularjs.我知道如何使用tastypieapi框架为django 集成这两个.

所以,如果我是正确的,django的后端会抛出一些可以被angularjs使用的JSON,依此类推.

我困惑的地方是facebook的身份验证机制.如何将Facebook的身份验证与我的应用程序集成?对于这样的应用程序,什么是好的设计?

我不希望任何人为我的应用程序提供完整的设计或架构,但我希望能够继续使用该应用程序.

谢谢 :)

django facebook-authentication angularjs

5
推荐指数
1
解决办法
1369
查看次数

Ionic Facebook Api无效密钥哈希

我无法让我的应用程序允许Facebook登录.每当用户尝试登录Facebook并使用他们的FB验证我的应用程序时,它会给我这个错误:

密钥哈希无效.它们的密钥哈希xxxxxxxxxx =与任何存储的密钥哈希值不匹配.在http://developers.facebook.com/apps/xxxxxxxx配置您的应用密钥哈希值

我已经尝试通过OpenSSL工具创建一个新的密钥哈希,如下所示:

keytool -exportcert -alias androiddebugkey -keystore debug.keystore | openssl sha1 -binary | openssl base64
Run Code Online (Sandbox Code Playgroud)

这样做会给我一个关键的哈希值,然后我将其添加到应用程序开发者页面的"Key Hashes"列表中.然后我使用ionic来重建应用程序,当我在我的Android手机上运行它时会出现同样的错误.还有另一个版本的应用程序是在另一台计算机上构建的,并且使用了不同的哈希密钥,并且工作正常,但是这台计算机的哈希密钥似乎不想工作.任何帮助都会很棒

android facebook facebook-authentication ionic

5
推荐指数
2
解决办法
7924
查看次数

为什么身份验证不能在自己的域上工作,而是在firebase的域上工作?

如果你去https://wfolly.firebaseapp.com/,你可以通过点击"Iniciar sesion"登录Facebook.然后,您将在注销文本"Cerrar sesion - 您的FACEBOOK NAME"旁边看到您的姓名.

但是,虽然auth适用于上面的wfolly.firebase.com,但它无法在https://debatenomasafp.org/上运行,我自己的域通过Firebase Hosting连接到Firebase自己的wfolly.fire(...)URL.

"无法正常工作"意味着您不会在注销文本"Cerrarsesión"旁边看到您的姓名,并且通常无法像您登录一样与网站进行互动.

怎么了?他们为什么表现不一样?

我知道两个站点的部署版本是相同的,因为当前部署反映了两个URL的后期更改,而不仅仅是Firebase.

身份验证也适用于localhost:8080预部署.

我使用Re-Base(github.com/tylermcginnis/re-base)进行身份验证请求可能相关也可能不相关.

subdomain facebook-authentication firebase firebase-hosting firebase-authentication

5
推荐指数
1
解决办法
1317
查看次数

是否有可能在开发Facebook应用程序以删除权限并重新开始?我需要改变我的范围并不断出错

我是这个Facebook编码游戏的新手,所以偶然发现了我认为只有我可能会遇到的错误.我最初想要允许用户登录来管理他们的页面,但是作为一个想法,客户希望他们的用户也能够发布到他们各自的页面.

所以,我在范围内添加了publish_stream权限,但我只是因为Facebook出错而陷入困境.

我是否必须先从应用程序中取消激活自己的文档:

https://developers.facebook.com/docs/authentication/

附上代码,任何帮助都会很棒:

$facebook = new Facebook(array(
        'appId'  => $this->app_id,
        'secret' => $this->secret,
    ));

    $s = setting::findAppSettingSpecific('social','facebook');

    // exit;
    $facebook->setAccessToken($s);
    $user = $facebook->getUser();
    $dia_url = 'http://localhost/social/accept/';
    $login_url = $facebook->getLoginUrl($params = array('redirect_uri' => $dia_url,'scope' => 'manage_pages,publish_stream'));
    if($user == 0) {


    }
    else
    {
        echo ("<script> top.location.href='".$login_url."'</script>");
        echo 'Facebook Loves Us';
        return true;
    }
Run Code Online (Sandbox Code Playgroud)

它正在使用Localhost,以防有人指出这一点,但是在添加额外权限时才开始调用错误.

提前致谢.

php facebook facebook-authentication facebook-php-sdk

4
推荐指数
1
解决办法
1560
查看次数

使用Twitter/Facebook身份验证时出现Rails 4错误.设计

我正在使用设计,我正在尝试允许用户使用twitter/facebook注册.我很困惑,因为我一直得到\没有路由匹配{:controller =>"authentications",:action =>"passthru",:provider =>:twitter,:format => nil}缺少必需的密钥:[:provider]

的routes.rb

 devise_for :users,controllers: {omniauth_callbacks: "authentications", registrations: "registrations"}
Run Code Online (Sandbox Code Playgroud)

AuthenticationController.rb

class AuthenticationsController < ApplicationController
  def index
    @authentications = Authentication.all
  end

  def create
    @authentication = Authentication.new(params[:authentication])
    if @authentication.save
      redirect_to authentications_url, :notice => "Successfully created authentication."
    else
      render :action => 'new'
    end
  end

  def destroy
    @authentication = Authentication.find(params[:id])
    @authentication.destroy
    redirect_to authentications_url, :notice => "Successfully destroyed authentication."
  end
  def twitter
raise omni = request.env["omniauth.auth"].to_yaml
end
end
Run Code Online (Sandbox Code Playgroud)

twitter ruby-on-rails devise omniauth facebook-authentication

4
推荐指数
1
解决办法
2518
查看次数

结合Facebook和Google auth for Firebase Android

背景

大家好,我是Firebase for Android的新手,我正试图首次实现Facebook和Google身份验证/登录.我按照这两个教程进行了相应的身份验证:

  • http:// firebase.google.com/docs/auth/android/google-signin
  • http:// firebase.google.com/docs/auth/android/facebook-login

另外,在FacebookSignInActivityGoogleSignInActivity正在努力,他们应该.

问题

问题是我试图在同一活动中使用Google和Facebook身份验证,但它不起作用.像这样:

结果布局图像

我做了什么

我试图通过让它们扩展并在那里设置布局来保持FacebookSignInActivity分离.GoogleSignInActivityMainActivity

但我认为我应该把这两者合二为一.所以我尝试了但是我得到了一个奇怪的nullpointer异常:

java.lang.NullPointerException: Attempt to invoke virtual method 'void com.google.firebase.auth.FirebaseAuth.addAuthStateListener(com.google.firebase.auth.FirebaseAuth$AuthStateListener)' on a null object reference
Run Code Online (Sandbox Code Playgroud)

我不知道为什么对象在null中是onCreate因为我从其他两个正在运行的活动中复制了相同的代码:

 mAuth = FirebaseAuth.getInstance();

 mAuthListener = new FirebaseAuth.AuthStateListener() {
            @Override
            public void onAuthStateChanged(@NonNull FirebaseAuth firebaseAuth) {
                FirebaseUser user = firebaseAuth.getCurrentUser();
                if (user != null) {
                    // User is signed in
                    Log.d(TAG, "onAuthStateChanged:signed_in:" + user.getUid());
                } else {
                    // User is signed out
                    Log.d(TAG, …
Run Code Online (Sandbox Code Playgroud)

android google-authentication facebook-authentication firebase firebase-authentication

4
推荐指数
1
解决办法
8067
查看次数

throw new TypeError('OAuth2Strategy 需要验证回调');

所以我正在学习node.js和facebook身份验证,我遇到了这个错误:

/home/lindan4/Git/HelloNodeJS/ChatTime/node_modules/passport-oauth2/lib/strategy.js:79
  if (!verify) { throw new TypeError('OAuth2Strategy requires a verify callback'); }
                 ^

TypeError: OAuth2Strategy requires a verify callback
    at Strategy.OAuth2Strategy (/home/lindan4/Git/HelloNodeJS/ChatTime/node_modules/passport-oauth2/lib/strategy.js:79:24)
    at new Strategy (/home/lindan4/Git/HelloNodeJS/ChatTime/node_modules/passport-facebook/lib/strategy.js:55:18)
    at module.exports (/home/lindan4/Git/HelloNodeJS/ChatTime/app/auth/index.js:42:16)
    at Object.<anonymous> (/home/lindan4/Git/HelloNodeJS/ChatTime/server.js:3:22)
    at Module._compile (internal/modules/cjs/loader.js:707:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:718:10)
    at Module.load (internal/modules/cjs/loader.js:605:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:544:12)
    at Function.Module._load (internal/modules/cjs/loader.js:536:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:760:12)
    at startup (internal/bootstrap/node.js:308:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:878:3)
Run Code Online (Sandbox Code Playgroud)

这是代码:

'use strict';

const passport = require('passport');
const config = require('../config');
const FacebookStrategy = require('passport-facebook').Strategy;

const helper = require('../helpers');

module.exports = () => …
Run Code Online (Sandbox Code Playgroud)

node.js oauth-2.0 express facebook-authentication

4
推荐指数
1
解决办法
4700
查看次数

如何在颤振中使用 facebook 执行 firebase 身份验证

我正在尝试在我的应用程序中添加 firebase 和 facebook 身份验证。Facebook 身份验证已经完成:

final facebookLogin = FacebookLogin();
final result = await facebookLogin.logInWithReadPermissions(['email']);

switch (result.status) {
  case FacebookLoginStatus.loggedIn:
    final token = result.accessToken.token;
    final graphResponse = await http.get(
        'https://graph.facebook.com/v2.12/me?fields=name,first_name,last_name,email&access_token=$token');
    Map<String, dynamic> user = jsonDecode(graphResponse.body);
    // _onGetFacebookUser(user);
Run Code Online (Sandbox Code Playgroud)

我不知道如何使用 facebook 结果执行 firebase 身份验证。

我已经看过这个答案,但它没有帮助,只有 facebook 登录代码示例。我找到了这篇文章,但没有方法signInWithFacebook

facebook facebook-authentication firebase firebase-authentication flutter

4
推荐指数
1
解决办法
2094
查看次数