400 bad request from POST request

Apologies.

  def create
    session_code = params[:code]
    puts session_code
    response = RestClient.post("https://id.twitch.tv/oauth2/token", {:client_id => "#{ENV["id"]}", 
          :client_secret => "#{ENV["secret"]}", 
          :code => session_code, 
          :grant_type => "authorization_code", 
          :redirect_uri => "http://localhost:3000" })
    access_token = JSON.parse(response)["access_token"]
    session[:token] = access_token
    client = Twitch::Client.new(:client_id => "#{ENV["id"]}",
          :client_secret => "#{ENV["secret"]}", 
          token_type: :user)
    puts client.access_token
    user = client.get_users(access_token: access_token).data.first
    @profile_data = { :image => user.profile_image_url, :name => user.display_name, :twitch_id => user.id }
    if User.find_by(@profile_data) == nil
      @profile = User.new(@profile_data)
      @profile.save
    else
      @profile = User.find_by(@profile_data)
    end
@profile_data = session[:profile_data] 

end