Xử lý API facebook login

1. The official graph endpoint for inspecting access tokens is:
GET graph.facebook.com/debug_token?
      input_token=[user_access_token]&
      access_token=[app_token_or_admin_token]
Example response:
{
    "data": {
        "app_id": 138483919580948, 
        "application": "Social Cafe", 
        "expires_at": 1352419328, 
        "is_valid": true, 
        "issued_at": 1347235328, 
        "metadata": {
            "sso": "iphone-safari"
        }, 
        "scopes": [
            "email", 
            "publish_actions"
        ], 
        "user_id": 1207059
    }
}
Yêu cầu phía mobile gửi một cái mã user_access_token


Sau đó Phía server cần verify cái mã này bằng API bên trên

Vấn đề là đào đâu ra cái mã này app_token_or_admin_token


GET graph.facebook.com/debug_token?
    input_token={token-to-inspect}
    &access_token={app_id}|{app_secret}
nó chính là cái app_id hoặc app_secrect trong trang quản trị tạo app Facebook developer

hoặc bằng cách này
GET "https://graph.facebook.com/oauth/access_token
  ?client_id=your-app-id
  &client_secret=your-app-secret
  &grant_type=client_credentials"



2. Use this way 
This will return the app this token was generated for, you can compare that against your app's id.

Done

Comments

Popular posts from this blog

Fixing the DeepSpeed Import Error While Fine-Tuning the Qwen Model

Amazon Linux 2023 - User data configuration for launch templates to connect to the EKS cluster

How to create ISM policy and rotate logs in opensearch