首页 > 解决方案 > omn​​aith-auth0 gem 的自定义设置

问题描述

我正在使用omniauth-auth0 gem 在我的应用程序中使用auth0 starategy。现在我想做自定义设置,比如(对于 twitter):

  request = Rack::Request.new(env)
  user = User.find_by_subdomain(request.subdomain)
  env['omniauth.strategy'].options[:client_id] = user.consumer_key          # if using omniauth-oauth2
  env['omniauth.strategy'].options[:client_secret] = user.consumer_secret   # if using omniauth-oauth2
  env['omniauth.strategy'].options[:consumer_key] = user.consumer_key       # if using omniauth-oauth
  env['omniauth.strategy'].options[:consumer_secret] = user.consumer_secret # if using omniauth-oauth
end

use OmniAuth::Builder.new do
  provider :twitter, :setup => SETUP_PROC
end

不幸的是,对于 auth0 这不起作用。如何在 oomniauth-auth0 策略中执行此操作?

标签: ruby-on-railsauth0

解决方案


推荐阅读