Sorcery undefined method `login_at' - ruby-on-rails

I'm trying to get auth for Twitter and Facebook by this guide https://github.com/NoamB/sorcery/wiki/External, but I've got a problem - undefined method 'login_at' for #<OauthsController:0xa99d6bc>. Frankly I can't find this function(login_at) in guide. How can I fix it?

Ensure that you have External submodule included in your Sorcery configuration:
Rails.application.config.sorcery.submodules = [:external, ...]

Related

In Ruby on Rails, how to intercept the Devise gem's email sending functionality and change it to call an API instead? [duplicate]

As my reputation is lower than 50, so Im not able to comment below the accepted answer in this post In Rails Devise gem how to modify the send_reset_password_instructions method? for more information.
I want to customize recoverable.rb in devise. I made a copy of it in my folder with path lib/devise/models/recoverable.rb. The problem is when request to send reset password instruction, I got error undefined method activerecord51? for Devise:Module. How do i solve this?
It seems my recoverable is not in Devise module. I tried a bit by making a copy of devise.rb in lib/ folder. But it doesn't help.
Can someone please help?
EDIT
Sorry for any inconvenience. At the moment Im just trying to pass more opts to the method send_reset_password_instructions.
Any idea about this?
How about do it in some rails initializer? Your are possibly overwriting the original class/module so all the other methods are gone.
# config/initalizers/devise.rb
Devise::Models::Recoverable::ClassMethods.module_eval do
def send_reset_password_instructions(your, params)
token = set_reset_password_token
send_reset_password_instructions_notification(token)
token
end
end

How to access the Mailchimp file-manager/files API endpoint using Gibbon

I'm using Gibbon to access the Mailchimp API.
I've no problem using...
gibbon = Gibbon::Request.new(api_key: "valid-api-key")
lists = gibbon.lists.retrieve
And getting back the lists stored in the account.
However I'm struggling with the file-manager/files API endpoint.
Trying...
files = gibbon.file-manager.files.retrieve
throws a undefined local variable or method 'manager' for main:Object (NameError) error. Which suggests that the - sign is not being correctly parsed.
And...
files = gibbon.filemanager.files.retrieve
returns a 404 error as you'd expect.
So my question : Is this a problem with the Gibbon Gem or is there another way to access the file-manager/files endpoint?
I think you made the right call in issuing an issue on their github page :).
I believe their method_missing magic is having a little trouble figuring out this hyphen indeed.
Turns out that Gibbon expects you to use underscores _ instead of dashes - in the calls.
The correct call is...
files = gibbon.file_manager.files.retrieve

Undefined method 'login_at' with Sorcery and 0auth, rails 4

I'm trying to set up Oauth with this rails project, but everytime I click 'login with ...' in my view, it renders an undefined method error for 'login_at'. My Sorcery config file contains the specific external submodule
Rails.application.config.sorcery.submodules = [:remember_me, :external]
but I still can't get past that error, any help would be greatly appreciated
You also have to provide external providers to sorcery config, e.g.
Rails.application.config.sorcery.configure do |config|
...
config.external_providers = [:twitter, :facebook]
...
end

Rails 3.2 + Facebook auth + CSRF FAILURE

This is the error that I see when trying to login via facebook, I always see that error. Can't seem to get rid of it:
Could not authorize you from Facebook because "Csrf detected".
I put a skip:
skip_before_filter :verify_authenticity_token
on the Omniauth callback, but still I get the error. This is in both local and prod (heroku) environments. I have set the heroku environment variables. Any idea?
I had the same issue you have on the same day!!
I thought it was a gem update or something like this but not at all.
With a deep debugging I found that omniauth "Callback phase initiated." was called twice.
It was due to a stupid double initialization of
provider :facebook, .....
One in config/initializers/devise.rb and in another initializer.
I hope it will give you an hint to find your error
I found that the problem was the gem was too new and passing a STATE header to facebook, which fb didn't want. I rolled the omniauth-facebook gem version back and it worked
Are you sending a p3p header maybe add...
before_filter :set_p3p
private
def set_p3p
headers['P3P'] = 'CP="ALL DSP COR CURa ADMa DEVa OUR IND COM NAV"'
end
to your application controller

How can I fix this undefined method error?

I am integrating Postmark's transactional email service into my web application so that when a user signs up, my application sends the user a welcome email. When I try to signup as a user, I get the following error: undefined method `postmark_settings=' for ActionMailer::Base:Class
In my config/application.rb file, I have the following code:
config.action_mailer.delivery_method = :postmark
config.action_mailer.postmark_settings = { :api_key => "my_api_key" }
I'm not sure what is causing the error or how I can go about fixing it. If I haven't provided enough useful information to solve the problem, just let me know and I'll add whatever code might be useful. Thanks so much!
Have you included the line below in your Gemfile?
gem 'postmark-rails', '0.4.0'
There are similar issues where people haven't included this line on the Gemfile...
Also, are you using Rails 3? The configuration in different between Rails 2 and 3. Please note details here.

Resources