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

Multiple scopes for the same strategy #793

Open
bsylvain opened this issue Feb 16, 2015 · 1 comment
Open

Multiple scopes for the same strategy #793

bsylvain opened this issue Feb 16, 2015 · 1 comment

Comments

@bsylvain
Copy link

Is it possible to do have a way to sign_in with different scopes?

I want to do something like this :

signin_path(scope: "toto")

and like this

signin_path(scope:"other_scope")

here is my strategy :

module OmniAuth
  module Strategies
    class ResaNetwork < OmniAuth::Strategies::OAuth2

      DEFAULT_SCOPE = :public

      def authorize_params
        super.tap do |params|
          Rails.logger.debug "THE PARAMS #{request.env['omniauth.params'].inspect}"
        end
      end
      option :name, :resa_network

      option :client_options, {
        #site: "http://dylog.ubuntu-sylario.net:3000",
        site: ENV["CLIENT_OPTION_SITE"],
        authorize_path: "/oauth/authorize"
      }

      uid do
        Rails.logger.debug "------ #{raw_info.inspect}--------"
        raw_info["resource_owner_id"]
      end

      info do
        {username: raw_info["username"]}
      end

      def raw_info
        @raw_info ||= access_token.get('/api/user').parsed
      end
    end
  end
end

How can I get back the scope params and use it to ask for the token?

@salbertson
Copy link

@bsylvain what approach did you take to use different scopes?

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