How to Get Facebook App Secret Keys And Access Token?
To display Facebook stream feeds, you need a Facebook App secret key and Access Token. To get Facebook App Secret key and Access Token, Firstly you need to create Facebook Application as showing in below:
- Go to https://developers.facebook.com and log in.
- Register as a developer. After register as a developer, you can create your app.
- If you’re already registered before choose on the navigation bar My Apps -> Add a New App.
- Select ‘More options’ app type. and click on Continue button. After that Select ‘Something Else’ and click on Continue button.
- Enter the App Display name, your email and click Create App.
- IMPORTANT! Leave your app in Development mode.
- Copy App ID at the top of the page. And paste your App ID on Social Streams Designer Plugin’s page in the admin panel.
How to Get App Secret?
- On Facebook Developers navigate to Settings -> Basic.
- Click on Show in the field App Secret and confirm your Facebook password.
- Copy revealed key and paste it on your Social Streams Designer Plugin’s page in the admin panel.
How to Generating Token?
- For streaming public pages please go to Explorer Tool https://developers.facebook.com/tools/explorer.
- Expand Get Token dropdown and choose Get Page Access Token. Approve access, ignore the warning, it’s not needed for getting your page feed.
- Choose the page you want to stream for the plugin in the same Get Token dropdown.
- Before generating the access token, you should give the permissions which you needed for your page access token or user access token. Select the permissions which you want from Permissions section after the selection of page or user access token.
For Page access token, these permissions should be there to get the proper data: page_events, pages_manage_ads, pages_manage_cta, pages_manage_engagement, pages_manage_instant_articles, pages_manage_metadata, pages_manage_posts, pages_messaging, pages_read_engagement, pages_read_user_content, pages_show_list, user_events & user_managed_groups
For others usage, these permissions should be there to get the proper data: instagram_basic, instagram_content_publish, instagram_manage_comments, instagram_manage_insights, instagram_manage_messages & publish_video
- Once you select the page, It will generate the new access token. This is short-lived access token. A short-lived token vaild upto 1 hour.
Create Long-lived Access token
A long-lived User access token you can generate one from a short-lived User access token. A long-lived token generally lasts about 60 days.
https://graph.facebook.com/v7.0/oauth/access_token?
grant_type=fb_exchange_token&
client_id={app-id}&
client_secret={app-secret}&
fb_exchange_token={your-access-token}
Replace {app-id}
, {app-secret}
and {your-access-token}
with your Facebook app id, your Facebook app secret and your short-lived access token. Open a new browser window and load the Authorization Window URL.The API will return a JSON encoded object containing a Long-lived Facebook User Access Token,
{
“access_token”:”{long-lived-user-access-token}”,
“token_type”: “bearer”,
“expires_in”: 5183944
}
Just copy the newly generated Page Access Token from the token field and paste it on your Social Streams Designer Plugin’s page in the admin panel.
Token Expiration
Facebook want their user accounts to be safe, and for that, they have set certain safety boundaries. On finding any suspicious activity happening around or within your account, your credential/token might expire.
The possible reasons behind your credential/token expirations are:
- You may haven’t logged in even once in the last 2 months (the most usual reason).
- You’ve recently changed your Facebook password.
- You’ve recently logged out of Facebook.
- Logging in and out of multiple Facebook accounts from your device.
- Facebook has detected a security issue on your account.
- Facebook suspects spammy behavior on your account (like posting too frequently or repetitive content).
- Suspicious (Login attempts from a new location) and later not having the full permissions required. In case if you initially grant the permissions and decide to stop using our authentication, we do not have access without your permission.
2. 分享目的仅供大家学习和交流,请不要用于商业用途!
3. 如果你也有好源码或者教程,可以到审核区发布,分享有金币奖励和额外收入!
4. 本站提供的源码、模板、插件等等其他资源,都不包含技术服务请大家谅解!
5. 如有链接无法下载、失效或广告,请联系管理员处理!
6. 本站资源售价只是赞助,收取费用仅维持本站的日常运营所需!
7. 如遇到加密压缩包,默认解压密码为"Yongwp.com",如遇到无法解压的请联系管理员!
WordPress外贸建站 » How to Get Facebook App Secret Keys And Access Token?