Question

I am using eventbrite omniauth to authenticate the user. With reference to https://github.com/k504866430/omniauth-eventbrite I included the gem and created a file omniauth.rb file as:

Rails.application.config.middleware.use OmniAuth::Builder do
  provider :eventbrite, ENV['EVENTBRITE_CLIENT_ID'], ENV['EVENTBRITE_CLIENT_SECRET']
end

On the show page of each event there is link to Authenticate with eventbrite.

events/24

 = link_to "Authenticate with Eventbrite", "/auth/eventbrite"

When the user allows to access I want the callback url to redirect to same event page.

Thus I need to know how to pass the event_id in params so that the application can return to the same event page and how should the callback url be defined in routes.rb file

Était-ce utile?

La solution

Eventbrite's OAuth2.0 implementation does not allow you to define the OAuth callback URL as a querystring parameter. This callback_url can only be defined by configuring your Eventbrite application key's 'redirect_uri' setting.

Pass-through of custom querystring parameters (such as an event_id) is also not supported. Besides, you'll need to do a bit of follow-up work AFTER the user arrives back on your site.

If you need to redirect a user after they return to your website, I would consider stashing the 'redirect_url' (and possibly the event_id as well) in the user's browser session or another data store.
Setting up a single landing page (to match your redirect_uri) should allow you to complete the OAuth2.0 handshake before sending the user on to a url of your choice.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top