GithubHelp home page GithubHelp logo

omniauth-foursquare's Introduction

OmniAuth Foursquare

This gem contains the Foursquare strategy for OmniAuth.

Foursquare uses the OAuth2 flow, you can read about it here: https://developer.foursquare.com/docs/oauth.html

How To Use It

So let's say you're using Rails, you need to add the strategy to your Gemfile:

gem 'omniauth-foursquare'

You can pull them in directly from github e.g.:

gem 'omniauth-foursquare', :git => 'https://github.com/arunagw/omniauth-foursquare.git'

Once these are in, you need to add the following to your config/initializers/omniauth.rb:

Rails.application.config.middleware.use OmniAuth::Builder do
  provider :foursquare, "consumer_key", "consumer_secret"
end

You will obviously have to put in your key and secret, which you get when you register your app with Foursquare (they call them API Key and Secret Key).

Now just follow the README at: https://github.com/intridea/omniauth

Supported Rubies

OmniAuth Foursquare is tested under 1.8.7, 1.9.2, 1.9.3, 2.x and Ruby Enterprise Edition.

CI Build Status

License

Copyright (c) 2011 by Arun Agrawal

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

omniauth-foursquare's People

Contributors

andreazaupa avatar arunagw avatar bitdeli-chef avatar paulosman avatar reidab avatar rud avatar sgerrand avatar spony avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

omniauth-foursquare's Issues

Feature Request: add display options to client_params

Hi!

It would be nice if the gem can support the :display parameter in the client params method, now i have my omniauth-foursquare gem patched in this way:

def client_params
{:client_id => options[:client_id], :redirect_uri => callback_url ,:response_type => "code", :display => options[:display]}
end

The :display is set in the omniauth initializer as :display => 'webpopup' and work great for me.

Thanks for the gem!

ssl error

Hi.
Recently, i update omniauth version. And, I started to use omniauth-foursquare.

mypage can

  1. get /auth/foursquare
  2. and redirect foursquare authorization page.
  3. if I select allow, redirect mypage.

=> next, I have looked this error.

Faraday::Error::ConnectionFailed (SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed)

How can I solve this error?

  • I have tried such article(add client_options) but , not work.
  • everyone writes, update ruby in rvm and reinstall openssl in rvm, but i don't use rvm
  • environment is
    • CentOS release 5.6 (Final)
    • ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-linux] it is not rvm. native install
    • 'rails', '3.1.3'
  • I have used old omniauth version 0.3.0, and I can login foursquare.if I update this version, It doesnot work.

omniauth-foursquare isn't compliant with the auth hash schema

Based upon the omniauth wiki -
https://github.com/intridea/omniauth/wiki/Auth-Hash-Schema

The image should be "A URL representing a profile image of the authenticating user. Where possible, should be specified to a square, roughly 50x50 pixel image.", however in case on omniauth-foursquare it's a hash.

In my projects I do something like this in order to normalize it (50x50 was proven to be to small for me):

image =  [image['prefix'], '100x100', image['suffix']].join

I think that it's a sensible approach to return a URL for info.image, and put this has in the 'extra' hash (if it's not there already).

Foursquare API now require a version params

Hi!
I've got this error on the callback_phase

<OAuth2::Error: :
{"meta":{"code":410,"errorType":"param_error","errorDetail":"The Foursquare API no longer supports requests that do not pass in a version parameter. For more details see https://developer.foursquare.com/overview/versioning"},"response":{}}>

In the Foursquare docs is reported that all requests require a v=YYYYMMDD parameter from date 28-01-2014.

https://developer.foursquare.com/overview/versioning

I will try to make a pull request for this, but I don't have eneugh time at this moment ...

Csrf detected

Hi there,
I've spent a number of hours researching this before deciding to ask here.
Upon signing in, I keep being bounced to my app (/users/sign_in#=) with the following error:
Could not authenticate you from Foursquare because "Csrf detected"

Any insights?

This is what I see last in the console:

  • I, [2014-10-19T19:43:38.947771 #2] INFO -- omniauth: (foursquare) Request phase initiated.
  • Started GET "/users/auth/foursquare" for 142.255.113... at 2014-10-19 19:43:38 +0000
  • Parameters: {"code"=>"2MZGM413...", "state"=>"1ba1cec3beb4..."}
  • Processing by Devise::SessionsController#new as HTML
  • Started GET "/users/auth/foursquare/callback?code=2MZGM413...&state=1ba1cec3beb4..." for 142.255.113... at 2014-10
  • I, [2014-10-19T19:43:39.378477 #2] INFO -- omniauth: (foursquare) Callback phase initiated.
  • E, [2014-10-19T19:43:39.378660 #2] ERROR -- omniauth: (foursquare) Authentication failure! csrf_detected: OmniAuth::Strategies::OAuth2::CallbackError, csrf_detected | CSRF detected

Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.