mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
Merge pull request #11362 from meteor/override-api-version
Upgrade default Facebook API to v10 & allow overriding this value
This commit is contained in:
@@ -1,4 +1,11 @@
|
||||
## Changelog
|
||||
# Changelog
|
||||
## 1.8.0 - unreleased
|
||||
### Breaking changes
|
||||
- N/A
|
||||
|
||||
### Changes
|
||||
- Updated to use Facebook GraphAPI v10
|
||||
- You can now override the default API version by setting `Meteor.settings.public.packages.facebook-oauth.apiVersion` to for example `8.0`
|
||||
|
||||
## 1.7.3 - 2020-10-05
|
||||
### Breaking changes
|
||||
|
||||
@@ -30,8 +30,10 @@ Facebook.requestCredential = (options, credentialRequestCompleteCallback) => {
|
||||
|
||||
const loginStyle = OAuth._loginStyle('facebook', config, options);
|
||||
|
||||
const API_VERSION = Meteor.settings?.public?.packages?.['facebook-oauth']?.apiVersion || '10.0';
|
||||
|
||||
let loginUrl =
|
||||
`https://www.facebook.com/v8.0/dialog/oauth?client_id=${config.appId}` +
|
||||
`https://www.facebook.com/v${API_VERSION}/dialog/oauth?client_id=${config.appId}` +
|
||||
`&redirect_uri=${OAuth._redirectUri('facebook', config, options.params, options.absoluteUrlOptions)}` +
|
||||
`&display=${display}&scope=${scope}` +
|
||||
`&state=${OAuth._stateParam(loginStyle, credentialToken, options && options.redirectUrl)}`;
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
Facebook = {};
|
||||
import crypto from 'crypto';
|
||||
|
||||
const API_VERSION = Meteor.settings?.public?.packages?.['facebook-oauth']?.apiVersion || '10.0';
|
||||
|
||||
Facebook.handleAuthFromAccessToken = (accessToken, expiresAt) => {
|
||||
// include basic fields from facebook
|
||||
// https://developers.facebook.com/docs/facebook-login/permissions/
|
||||
@@ -65,7 +67,7 @@ const getTokenResponse = query => {
|
||||
const redirectUri = OAuth._redirectUri('facebook', config, undefined, absoluteUrlOptions);
|
||||
// Request an access token
|
||||
responseContent = HTTP.get(
|
||||
"https://graph.facebook.com/v8.0/oauth/access_token", {
|
||||
`https://graph.facebook.com/v${API_VERSION}/oauth/access_token`, {
|
||||
params: {
|
||||
client_id: config.appId,
|
||||
redirect_uri: redirectUri,
|
||||
@@ -104,7 +106,7 @@ const getIdentity = (accessToken, fields) => {
|
||||
hmac.update(accessToken);
|
||||
|
||||
try {
|
||||
return HTTP.get("https://graph.facebook.com/v8.0/me", {
|
||||
return HTTP.get(`https://graph.facebook.com/v${API_VERSION}/me`, {
|
||||
params: {
|
||||
access_token: accessToken,
|
||||
appsecret_proof: hmac.digest('hex'),
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
Package.describe({
|
||||
summary: "Facebook OAuth flow",
|
||||
version: "1.7.4"
|
||||
version: "1.8.0"
|
||||
});
|
||||
|
||||
Package.onUse(api => {
|
||||
|
||||
Reference in New Issue
Block a user