Allow setting callback & redirect route/params via query parameters

Created on 29 August 2017, almost 8 years ago
Updated 16 July 2025, 10 days ago

For my use case, I needed to add certain Facebook permissions for the user to grant access to, and also wished to specify the URL to redirect to after successful authorisation.

I've added the ability to use query parameters in the `social_post_facebook.redirect_to_facebook`, for example:

$query = [
  // Add params to the Facebook API call
  'api_params' => [
    'permissions' => [
      'publish_actions',
      'public_profile',
      'email'
    ]
  ],
  // Specify a different callback route if you want to eg. add extra actions on saving a social account
  'callback_route' => 'my_module.callback',
  // Specify a different redirect route if you want to redirect somewhere other than /user after authorisation is finished
  'redirect_route' => 'entity.node.canonical',
  // You can specify params for the redirect route - these get added as ROUTE parameters (not query)
  'redirect_params' => [
    'node' => 1 // redirect to node/1
  ],
];

// If eg. redirecting via a form
$form_state->setRedirect('social_post_facebook.redirect_to_facebook', [], ['query' => $query]);
✨ Feature request
Status

Closed: outdated

Version

1.0

Component

Code

Created by

πŸ‡¨πŸ‡¦Canada bgilhome Victoria

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024