atlassian crowd and omniauth_crowd - ruby-on-rails

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.

Related

Internal server error response during rails omniauth docusign callback

I am connecting to DocuSign via oauth with Rails 6 and Omniauth - it seems I have it configured correctly since visiting /auth/docusign takes me to the DocuSign login screen. After logging in, it takes me to the callback. The callback is failing because the omniauth-docusign gem is failing with the user_info hash. Where it should be getting user_info['accounts'] it is getting this:
user_info #=> {"error"=>"internal_server_error", "reference_id"=>"a0f0e8c9-2faa-4b70-90b8-875ae40f13cf"}
My API Dashboard for the App shows no log or request info. 0 total requests. Is there a log area for oauth attempts, or where to use this reference ID?
Can someone at DocuSign help with this? Your developer support page seems to say to ask here on S/O.
It appears that you didn't configure everything correctly for your Integration Key (IK which is like clientId) as well as clientSecret and the rest of the configuration that you can do for your IK.
I would suggest that you can get a pre-built Ruby application that already had this all done for you and save you some work by going to the Quickstart. This would enable you to go get a ZIP file pre-configurated with all the required gems and everything needed for auth already set based on your own developer account.
Update: if you then want to take this code into your own app, you need to also get the authentication code supplied lib/docusign.rb instead of a gem like omniauth-docusign.
As Inbar Gazit said, it's important to use the Quickstart app, which I was doing. However, not only do I already have my own existing rails app, even if I didn't, I wouldn't want to have to clean out all the extra stuff in the quickstart app that I don't need. It would be nice to have a minimal script for installing just the bare minimum into an existing rails app to get authenticated and start using the API.
In the end, the solution for me was to notice and copy the lib/docusign.rb file from the Quickstart app, instead of using an omniauth-docusign gem. The base omniauth gem had advised me to find and install that gem because there was no strategy defined for docusign. The quickstart lib file is what I needed.

Missing scope error when adding new scope even though I am using shopify_app gem

I have an app which uses the Rails shopify_app gem (v11.5.0), and I want to add a new scope.
I have added the scope to the shopify_app.rb initializer and restarted the server, as well as the browser.
When I access the app via the admin interface, or via the install link, I get a "Oauth error missing_shopify_permission" error.
I believe this is supposed to work out of the box with the shopify_app gem, i.e. the merchant should be prompted about granting the new scope - am I doing something wrong ?
Thanks,
Louise
It turns out that some of the scopes in the graphql API does not exist c.f. https://community.shopify.com/c/Shopify-APIs-SDKs/write-publications-and-read-publications-access/m-p/506802 and https://community.shopify.com/c/Shopify-APIs-SDKs/Missed-access-scope-in-settings/m-p/449760

405 not allowed nginx, CORS? Nginx config? Or something else?

Working on an app built using Ember.js and Rails.
Authentication is being done with ember-simple-auth using Oauth2.
I am able to login to my app locally in my development environment, but as soon as I try to login on my production server (through Heroku) I start receiving a nginx 405 not allowed status code.
First thing I thought was maybe it is my request headers / CORS. I am using rack-cors gem on my rails side and configured it based directly off the readme example. Here is my application.rb
Researching, I found the same problem with the solution being to configure Nginx side of things, but I figured since that is being handled by heroku I wasn't really sure if that was where I need to make my changes.
Let me know if there are any other files/info that could help.
What is the best way to debug this problem?
Try using this first to rule out CORS:
https://chrome.google.com/webstore/detail/allow-control-allow-origi/nlfbmbojpeacfghkpbjhddihlkkiljbi
Does the route work locally when you use Postman or a similar tool?
Are you requesting HTML or JSON?

Redirection in RubyOnRails

I just got an SSL certificate for "example.com". After making some configurations in NGINX I could finally redirect "http://www.example.com" calls and "http://example.com" calls to "https://example.com". Everything works fine, but when I type "https://www.example.com" an SSL error is shown. Is there a way to redirect "https://www.example.com" calls to "https://example.com" using some Ruby code?
Handling the redirect at the Rack level and not inside of the Rails app is my preferred way to solve this requirement.
https://github.com/jtrupiano/rack-rewrite#scheme
The link takes you to the part of the README that addresses this question. I've used this gem in the past and it works really well.

Passenger (Rails)- way to restart via link?

Has anyone found a decent way to restart Passenger via a link? I need it for an admin so that they can just click a link (with a unique hash for protection) whenever our VPS provider has issues, if necessary.
I've tried having a secure link to a controller that just "touches" the tmp/restart.txt as well as writing to it, to no avail.
Any ideas?
You realize that this would need to be properly protected behind authentication and permission management right? Try using the FileUtils module from Ruby core.
You can use it by calling FileUtils.touch(filename) and its documentation is located here.

Resources