How can I configure the OAuth Scope in the method request?

question

#1

Hey, I set up the authorizer on my project, but I haven’t found where I can set the OAuth Scope. How can i do it?

37


#2

I see. Bummer. No way to currently set this. Would have to add support around here : https://github.com/tongueroo/jets/blob/master/lib/jets/resource/api_gateway/method.rb#L23-L40

Also, thinking about it generally. In addition to the specific option, may add a more generalized authorizer_options key option to the route DSL methods in case there are other future properties.

Will consider PRs. No sweat either way of course. Will dig into it time. Wanted to at least answer the question though.


#3

Hi,

I configured the authorizer in my project and I need to add the scope of OAuth. In your last answer, you wrote that it is not possible. I cloned the project and added the behavior.

I added two ways the add scope of OAuth, one on controllers and other on routes.

class ToysController < ApplicationController
  	authorization_scopes %w[create delete]

path: "posts", method: :get, to: "posts#index", authorization_scopes: %w[create delete]

I opened the PR in the Github repository.

https://github.com/tongueroo/jets/pull/468

The tests, docs and change are on the commits:

https://github.com/tongueroo/jets/commit/2a40e460b3c6d7c1f8f229e793bc587d8b65957c

https://github.com/tongueroo/jets/commit/1d8b301c6efe7f25644f1746dcef3f0cc67ce8b7

https://github.com/tongueroo/jets/commit/6ac3bf558dce70de24826b925842cc1e591baa86

#4

Thanks! Will take a look when get a chance!