非常感谢您提前帮助我。我正在开发一个应用程序,人们可以使用Slack对其进行身份验证,并且它会在自动生成内容的同时向其工作区发送通知。
但是发生oauth错误:
OAuth Error: Invalid client_id parameter
URL如下:
https://slack.com/oauth/authorize?client_id=XXXXXXXXXXX&scope=bot%2Cusers%3Aread.email%2Ccommands%2Cusers%3Aread&state=XXXXXXXXXXXXX&tracked=1
[尝试使用omniauth_slack
gem时,我遇到了同样的问题。
app / views / home / index.html.erb
<%= link_to "Sign in with Slack", slack_activate_path %>
app / controllers / slack_controller.rb
class SlackController < ApplicationController
def activate
oauth_state = "XXXXXXXXXXXXX"
uri = URI('https://slack.com/oauth/authorize')
uri.query = {
client_id: Rails.application.credentials[:slack][:client_id],
scope: 'bot,users:read.email,commands,users:read',
state: oauth_state,
}.to_query
redirect_to uri.to_s
end
def callback
end
end
config / routes.rb
Rails.application.routes.draw do
root 'home#index'
match '/slack/activate', to: 'slack#activate', via: 'get'
match '/slack/callback', to: 'slack#callback', via: 'get'
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
end
我在凭证上输错了client_id
。这不需要.
。