Strange Error with OmniAuth, AWS S3 and omniauth-stocktwits - ruby-on-rails

I have a rails app using omniauth for user authentication with facebook. twitter and google. I've add one more provider StockTwits, with gem omniauth-stocktwits. And now my application cant' start because of error:
/home/vladimir/.rvm/gems/ruby-1.8.7-p371#ea/gems/aws-s3-0.6.2/lib/aws/s3/extensions.rb:206:in `const_missing': uninitialized constant OmniAuth::Strategies::Stocktwits (NameError)
I cant understand what problem is... Why aws s3 raises error for omniauth? And What can I do to fix it?

The constant should be StockTwits, not Stocktwits. Are you calling it without the capital T anywhere?
Otherwise could you give me more information on how you're requiring and initializing omniauth-stocktwits, and what the rest of the stack trace from your error looks like, so I can try reproducing it?
Also Google is showing a lot of unrelated const_missing errors bubbling up through the AWS-S3 gem, so it's possible this is completely unrelated to AWS.

Related

block in load_missing_constant': uninitialized constant API::V1::Users (NameError)

Im trying to set up api endpoints for my rails application and keep receiving this error my environment is Ruby 2.6 and Rails 5.2 and im using the 'grape' gem for the api here is the blog I followed to set it up. https://medium.com/#ryanwaldorf/how-to-add-an-api-to-an-existing-rails-app-1d2419ba91bd
here is a link to my repo https://github.com/jslack2537/apiDemoApp
I believe the issue is wither in my config/routes.rb or my application.rb files.
But I could be totally wrong. This is a challenge app and not going to be used in production.
This mainly occurs when naming conventions doesn't match. Try changing api/v1/user.rb to api/v1/users.rb which also the blog suggests. You missed a 's'.

uninitialized constant DeviseTokenAuth::Concerns::User::BCrypt

Using the devise_token_auth gem, I am making a rails-based API in which I am trying to reset my password using email.
On opening the email with reset link, I get this Error:
uninitialized constant DeviseTokenAuth::Concerns::User::BCrypt
The code points to Api::V1::Overrides::PasswordsController#edit
tokens[client_id] = {
token: BCrypt::Password.create(token),
expiry: expiry
}.merge!(token_extras)
What can I do to make my reset link to go onto my reset form?
I am following this for PasswordsController action
Tried checking github but there no one actually has faced this sort of error and I cannot rectify it.
P.S. I am not an experienced Ruby developer.
Probably just missing the bcrypt gem, e.g. add this in your Gemfile:
gem 'bcryt`

Rails4 rails-api test: undefined session_serializer when testing auth via headers token

I have written a small app in order to practice with minitest. The stack is versioned as
follows:
Rails 4.1.4
ruby 2.1.2p95
devise 3.2.4
devise_token_auth 0.1.25
rails-api 0.2.1
The app has been generated from scratch as per rails-api instruction, and I can see
everything works as expected from the client side.
The difficutly I'm encountering is with controller's tests that have to deal with
authentication.
I took inspiration for this kind of test from:
https://github.com/lynndylanhurley/devise_token_auth/blob/master/test/controllers/demo_controller_test.rb
My test code is located at: http://pastebin.com/iPVk9Tzq
When I run the test suite I get back the following error:
PostsControllerTest#test_get_index_is_successful_if_logged_in:
NoMethodError: undefined method `session_serializer' for nil:NilClass
test/controllers/posts_controller_test.rb:24:in `block in <class:PostsControllerTest>'
I tried different searches over the net but I wasn't able to figure out how to solve
this issue.
I understand that the error happens because there's no session stored anywhere since the application is implemented as a stateless API.
Obviously if I comment out the "request.headers.merge! ..." line, the error disappear
and the test fails with a response of 401 (as it should when the user is not logged in).
Any help/suggestion is widely appreciated!
Regards
It turns out I simply forgot to include Devise::TestHelpers in my controller test class ...
Sorry :/

atlassian crowd and omniauth_crowd

I am using ruby-1.9, rails 3, and I am trying to login into crowd server using omniauth_crowd library. The configuration is very easy:
Rails.application.config.middleware.use OmniAuth::Builder do
provider :crowd, :crowd_server_url=>"http://some-crowd-server/crowd", :application_name=>"app-dev", :application_password=>"app-pass"
end
Also /auth/callback and /auth/failed is routed, but when I am trying to authenticate,
just after the login form when callback is called - I got:
uninitialized constant OmniAuth::Strategies::Crowd::CrowdValidator::Net
From looking into 'omniauth/strategies/crowd/crowd_validator.rb' I could
see a call Net:HTTP ... so I think I have not included some gem or else,
but not so experienced in ruby and have no idea now about what is wrong.
This sounds silly, but I ran into the same problem until I remembered to add my app server's IP to the application's list of allowed remote IPs. Try that.

NoMethodError when attempting to use open_id_authentication

I'm currently adding OpenID login support for a Rails 3.0.0 application.
I have already installed ruby-openid (the gem) and open_id_authentication (the plugin). However, after following the steps required to set up both (from the READMEs), I am still getting this error:
undefined method `authenticate_with_open_id'
I tried Googling the problem, but most threads seem to date from years ago and remain suspiciously unanswered.
Am I missing something obvious? What is causing this problem? Note that I have had no problems switching to file-based stores in environment.rb, so I am sure that the plugin is correctly installed.
Update: Some unresolved problems of the same nature:
http://railsforum.com/viewtopic.php?id=23151
Experiencing a similar error; oddly, I have this working on Rails 3.2 on another branch, and can't figure out the difference; anyhow I found that I got a little further by following suggestions here: Rails 3.0.9 + open_id_authentication
That is, adding the line include OpenIdAuthentication after class SessionsController < ApplicationController:
class SessionsController < ApplicationController
include OpenIdAuthentication
But now I get a Completed 401 Unauthorized in my log, and see a blank page -- just and tags. Ugh.
Update: Ooh, got further; I followed this post: open_id_authentication - "OpenIdAuthentication.store is nil. Using in-memory store." problem
and as they suggested, "added an initializer named config/initializers/openid.rb with this inside":
require 'open_id_authentication' # this was needed, but not described in the referred-to post
OpenIdAuthentication.store = :file
I was then directed to the OpenId provider and was able to click "allow", but on returning to my app, I now see:
NoMethodError in SessionsController#create
undefined method `encoding' for nil:NilClass
Anyhow, finally, I found a restful routes problem and fixed that, and now logging in works!

Resources