Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MATCH deprecated ? #9

Closed
brucellino opened this issue Nov 3, 2016 · 7 comments
Closed

MATCH deprecated ? #9

brucellino opened this issue Nov 3, 2016 · 7 comments

Comments

@brucellino
Copy link

It seems that the match method has been deprecated. When I use this example in my app (Rails 5.0.0.1) , indeed I get an error :

=> Rails 5.0.0.1 application starting in development on http://localhost:3000
=> Run `rails server -h` for more startup options
Exiting
/var/lib/gems/2.3.0/gems/actionpack-5.0.0.1/lib/action_dispatch/routing/mapper.rb:78:in `check_via': You should not use the `match` method in your router without specifying an HTTP method. (ArgumentError)
If you want to expose your action to both GET and POST, add `via: [:get, :post]` option.
If you want to expose your action to GET, use `get` in the router:
  Instead of: match "controller#action"
  Do: get "controller#action"

(full output below)

If I add the GET and POST routes individually, the server starts - haven't checked if the actual auth works.

Is there support for Rails 5 ?

Thanks !
Bruce


Full output

=> Booting Puma
=> Rails 5.0.0.1 application starting in development on http://localhost:3000
=> Run `rails server -h` for more startup options
Exiting
/var/lib/gems/2.3.0/gems/actionpack-5.0.0.1/lib/action_dispatch/routing/mapper.rb:78:in `check_via': You should not use the `match` method in your router without specifying an HTTP method. (ArgumentError)
If you want to expose your action to both GET and POST, add `via: [:get, :post]` option.
If you want to expose your action to GET, use `get` in the router:
  Instead of: match "controller#action"
  Do: get "controller#action"
	from /var/lib/gems/2.3.0/gems/actionpack-5.0.0.1/lib/action_dispatch/routing/mapper.rb:1609:in `match'
	from /home/becker/Ops/AAROC/ASR-SGW/config/routes.rb:11:in `block in <top (required)>'
	from /var/lib/gems/2.3.0/gems/actionpack-5.0.0.1/lib/action_dispatch/routing/route_set.rb:389:in `instance_exec'
	from /var/lib/gems/2.3.0/gems/actionpack-5.0.0.1/lib/action_dispatch/routing/route_set.rb:389:in `eval_block'
	from /var/lib/gems/2.3.0/gems/actionpack-5.0.0.1/lib/action_dispatch/routing/route_set.rb:371:in `draw'
	from /home/becker/Ops/AAROC/ASR-SGW/config/routes.rb:1:in `<top (required)>'
	from /var/lib/gems/2.3.0/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:287:in `load'
	from /var/lib/gems/2.3.0/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:287:in `block in load'
	from /var/lib/gems/2.3.0/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:259:in `load_dependency'
	from /var/lib/gems/2.3.0/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:287:in `load'
	from /var/lib/gems/2.3.0/gems/railties-5.0.0.1/lib/rails/application/routes_reloader.rb:40:in `block in load_paths'
	from /var/lib/gems/2.3.0/gems/railties-5.0.0.1/lib/rails/application/routes_reloader.rb:40:in `each'
	from /var/lib/gems/2.3.0/gems/railties-5.0.0.1/lib/rails/application/routes_reloader.rb:40:in `load_paths'
	from /var/lib/gems/2.3.0/gems/railties-5.0.0.1/lib/rails/application/routes_reloader.rb:16:in `reload!'
	from /var/lib/gems/2.3.0/gems/railties-5.0.0.1/lib/rails/application/routes_reloader.rb:26:in `block in updater'
	from /var/lib/gems/2.3.0/gems/activesupport-5.0.0.1/lib/active_support/file_update_checker.rb:77:in `execute'
	from /var/lib/gems/2.3.0/gems/railties-5.0.0.1/lib/rails/application/routes_reloader.rb:27:in `updater'
	from /var/lib/gems/2.3.0/gems/railties-5.0.0.1/lib/rails/application/routes_reloader.rb:7:in `execute_if_updated'
	from /var/lib/gems/2.3.0/gems/railties-5.0.0.1/lib/rails/application/finisher.rb:119:in `block in <module:Finisher>'
	from /var/lib/gems/2.3.0/gems/railties-5.0.0.1/lib/rails/initializable.rb:30:in `instance_exec'
	from /var/lib/gems/2.3.0/gems/railties-5.0.0.1/lib/rails/initializable.rb:30:in `run'
	from /var/lib/gems/2.3.0/gems/railties-5.0.0.1/lib/rails/initializable.rb:55:in `block in run_initializers'
	from /usr/lib/ruby/2.3.0/tsort.rb:228:in `block in tsort_each'
	from /usr/lib/ruby/2.3.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
	from /usr/lib/ruby/2.3.0/tsort.rb:431:in `each_strongly_connected_component_from'
	from /usr/lib/ruby/2.3.0/tsort.rb:349:in `block in each_strongly_connected_component'
	from /usr/lib/ruby/2.3.0/tsort.rb:347:in `each'
	from /usr/lib/ruby/2.3.0/tsort.rb:347:in `call'
	from /usr/lib/ruby/2.3.0/tsort.rb:347:in `each_strongly_connected_component'
	from /usr/lib/ruby/2.3.0/tsort.rb:226:in `tsort_each'
	from /usr/lib/ruby/2.3.0/tsort.rb:205:in `tsort_each'
	from /var/lib/gems/2.3.0/gems/railties-5.0.0.1/lib/rails/initializable.rb:54:in `run_initializers'
	from /var/lib/gems/2.3.0/gems/railties-5.0.0.1/lib/rails/application.rb:352:in `initialize!'
	from /home/becker/Ops/AAROC/ASR-SGW/config/environment.rb:5:in `<top (required)>'
	from /home/becker/Ops/AAROC/ASR-SGW/config.ru:3:in `require_relative'
	from /home/becker/Ops/AAROC/ASR-SGW/config.ru:3:in `block in <main>'
	from /var/lib/gems/2.3.0/gems/rack-2.0.1/lib/rack/builder.rb:55:in `instance_eval'
	from /var/lib/gems/2.3.0/gems/rack-2.0.1/lib/rack/builder.rb:55:in `initialize'
	from /home/becker/Ops/AAROC/ASR-SGW/config.ru:in `new'
	from /home/becker/Ops/AAROC/ASR-SGW/config.ru:in `<main>'
	from /var/lib/gems/2.3.0/gems/rack-2.0.1/lib/rack/builder.rb:49:in `eval'
	from /var/lib/gems/2.3.0/gems/rack-2.0.1/lib/rack/builder.rb:49:in `new_from_string'
	from /var/lib/gems/2.3.0/gems/rack-2.0.1/lib/rack/builder.rb:40:in `parse_file'
	from /var/lib/gems/2.3.0/gems/rack-2.0.1/lib/rack/server.rb:318:in `build_app_and_options_from_config'
	from /var/lib/gems/2.3.0/gems/rack-2.0.1/lib/rack/server.rb:218:in `app'
	from /var/lib/gems/2.3.0/gems/railties-5.0.0.1/lib/rails/commands/server.rb:59:in `app'
	from /var/lib/gems/2.3.0/gems/rack-2.0.1/lib/rack/server.rb:353:in `wrapped_app'
	from /var/lib/gems/2.3.0/gems/railties-5.0.0.1/lib/rails/commands/server.rb:124:in `log_to_stdout'
	from /var/lib/gems/2.3.0/gems/railties-5.0.0.1/lib/rails/commands/server.rb:77:in `start'
	from /var/lib/gems/2.3.0/gems/railties-5.0.0.1/lib/rails/commands/commands_tasks.rb:90:in `block in server'
	from /var/lib/gems/2.3.0/gems/railties-5.0.0.1/lib/rails/commands/commands_tasks.rb:85:in `tap'
	from /var/lib/gems/2.3.0/gems/railties-5.0.0.1/lib/rails/commands/commands_tasks.rb:85:in `server'
	from /var/lib/gems/2.3.0/gems/railties-5.0.0.1/lib/rails/commands/commands_tasks.rb:49:in `run_command!'
	from /var/lib/gems/2.3.0/gems/railties-5.0.0.1/lib/rails/commands.rb:18:in `<top (required)>'
	from bin/rails:4:in `require'
	from bin/rails:4:in `<main>'
@mfenner
Copy link
Contributor

mfenner commented Nov 3, 2016

Bruce, can you clarify? omniauth-orcid is not a Rails application/engine.

@brucellino
Copy link
Author

Hi @mfenner my apologies for being vague.

I am trying to use orcid as an identity provider for a Rails app I'm working on. The idea is just to get the ORCID if the user.

I was following https://github.com/datacite/omniauth-orcid#rails trying to use this to do the authentication.

It's more a question than a bug - since there was a section on how to use the gem for rails, I thought I would report my experience following the README. The README has the line to MATCH a route, but that syntax is deprecated apparently in Rails 5. I'll be quite happy with "go do rails somewhere else" ;) Just wanted to leave a trail for the next person.

Or, I could just add a comment to the README ?

@mfenner
Copy link
Contributor

mfenner commented Nov 3, 2016

Thanks Bruce. DataCite is using omniauth-orcid in a Rails app, so this is the right place to open the issue. What we are doing in routes.rb at https://profiles.datacite.org is here: https://github.com/datacite/volpino/blob/master/config/routes.rb#L4-L12. Which looks slightly different, as we are using devise on top of omniauth. I hope our source code can give you some good ideas, but I should definitely update the documentation.

@brucellino
Copy link
Author

Thanks a lot Martin - I am also trying to use devise. I'll take a look at the link. We can close this in the meantime.

@mfenner
Copy link
Contributor

mfenner commented Nov 3, 2016

Great. One more thing: we had a number of discussions in the THOR project in the past few months about the role of ORCID as identity provider, and it is complicated (@TomDemeranville is the best person to ask more detailed questions). My conclusion for now is to use ORCID as one of several third-party login options, but require the ORCID ID for every account created. Using ORCID as the only login option is probably fine, but strictly speaking ORCID will not guarantee 24/7 uptime (and having a single third-party login as the only login option is probably not a good idea anyway).

@brucellino
Copy link
Author

brucellino commented Nov 3, 2016

Yes, I'm aware of the complications, and the "wrongness" of using ORCID to log in directly. For now, I'm just trying to finish a toy version of this app.

Indeed, I'm not after the identity of the person, but their ORCID. I do want to get it from their ORCID profile, rather than their ORCID identity (if that makes sense...), and get around the problem of self-assertion.

So the idea is that they would log into the app using their university IdP, then allow the application to read their public ORCID

@TomDemeranville I guess a proper discussion will be necessary when we get there...

@mfenner
Copy link
Contributor

mfenner commented Nov 3, 2016

Thanks @brucellino, this makes sense.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants