I am not using devise or some other like-gem. I am very new to RoR.
Here is my routes.rb
# For details on the DSL available within this file, see https://guides.rubyonrails.org/routing.html
Rails.application.routes.draw do
get "about", to: "about#index"
get "password", to: "passwords#edit", as: :edit_password
patch "password", to: "passwords#update"
get "password/reset", to: "password_resets#new"
post "password/reset", to: "password_resets#create"
get "password/reset/edit", to: "password_resets#edit"
patch "password/reset/edit", to: "password_resets#update"
get '/auth/:provider/callback', to: 'sessions#create'
get "sign_up", to: "registrations#new"
post "sign_up", to: "registrations#create"
get "sign_in", to: "sessions#new"
post "sign_in", to: "sessions#create"
delete "logout", to: "sessions#destroy"
root to: "main#index"
end
Here is user.rb
# email:string
# password_digest:string
#
# password:string virtual
# password_confirmation:string virtual
class User < ApplicationRecord
has_secure_password
validates :email, presence: true, format: { with: /\A[^@\s]+@[^@\s]+\z/, message: "must be a valid email address" }
end
here is my omniauth.rb
Rails.application.config.middleware.use OmniAuth::Builder do
provider :twitter,Rails.application.credentials.dig(:twitter,:api_key), Rails.application.credentials.dig(:twitter,:api_key)
end
I have made all the settings in my Twitter app. Please help.
OmniAuth.config.allowed_request_methods = [:post, :get]
to allow a get request to that route solves it but it throws another error. Additionally, using the line I just mentioned could be adding a security flaw. Will keep an eye for answers here. β Hilliaryomniauth.rb
you are digging:api_key
twice and I assume the latter should be:api_secret
. Have you tried to changed those details? β Hilliary