Code Monkey home page Code Monkey logo

omniauth-kongregate's Introduction

OmniAuth::Kongregate CI status

OmniAuth strategy for Kongregate authentication

Usage

Current version is mostly focused on auto-detecting the logged-in user when the application is running on a canvas.

Just add the provider as usual, passing your app's Kongregate API key (add /api to the URL to get it). For example:

Rails.application.config.middleware.use OmniAuth::Builder do
  provider :kongregate, 'YOUR_API_KEY'
end

When your game is first open on Kongregate, redirect to /auth/kongregate (preserving the kongregate_user_id and kongregate_game_auth_token parameters) to perform the authentication.

If the token is valid, /auth/kongregate/callback will fire. You can get the validated user_id and the username there with:

auth = request.env['omniauth.auth']
user_id = auth.uid
username = auth.extras['username']

Guest Access

Guest access (users that are not logged in on Kongregate) will result in an auto-generated, non-numeric value in user_id (so it won't clash with kongregate_user_id), prefixed with "g_", so applications have a set of temporary credentials until the user decides to authenticate.

TODO

  • Display the Kongregate login form for non-authenticated users

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Added some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

Special Thanks

  • pmariano, for implementing guest access.

omniauth-kongregate's People

Contributors

chesterbr avatar pitr avatar pmariano avatar

Stargazers

 avatar

Watchers

 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  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

omniauth-kongregate's Issues

Bug: doesn't work with guess access

You can find the guest access URL in your game's "API information". Attempting to log in with guest access gives this error:

OmniAuth::Error

invalid_credentials

{"user_id"=>"0",
 "game_auth_token"=>"[redacted]"}

Trace begins:

omniauth (1.1.1) lib/omniauth/failure_endpoint.rb:25:in `raise_out!'
omniauth (1.1.1) lib/omniauth/failure_endpoint.rb:20:in `call'
omniauth (1.1.1) lib/omniauth/failure_endpoint.rb:12:in `call'
omniauth (1.1.1) lib/omniauth/strategy.rb:459:in `fail!'
omniauth-kongregate (0.0.2) lib/omniauth/strategies/kongregate.rb:22:in `callback_phase'
omniauth (1.1.1) lib/omniauth/strategy.rb:219:in `callback_call'

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.