Giter Site home page Giter Site logo

omniauth-naver's Introduction

OmniAuth Naver

This is the OmniAuth strategy for authenticating to Naver. To use it, you'll need to sign up for an OAuth2 Application ID and Secret on the Naver.

Installation

Add this line to your application's Gemfile:

gem 'omniauth-naver'

And then execute:

$ bundle

Or install it yourself as:

$ gem install omniauth-naver

Usage

use OmniAuth::Builder do
  provider :naver, ENV['NAVER_KEY'], ENV['NAVER_SECRET']
end

Auth Hash

Here's an example Auth Hash available in request.env['omniauth.auth']:

{
  :provider=>"naver",
  :uid=>"48436401",
  :info=>{
    :name=>"홍길동",
    :email=>"[email protected]",
    :gender=>"male",
    :image=>"https://phinf.pstatic.net/contactthumb/52/2014/8/4/kimsuerim_1407162661934.jpg",
    :nickname=>"길동"
  },
  :credentials=>{
    :token=>"AAAAObBDnBitK5i1qRDH4S2OUFvBMMsxWURxpLPNPhQyIyb7bIfH/dUqf1T3e5a5A87X6SntI74aUVIMPupBqKPYB3s=",
    :refresh_token=>"zdaiiVqKazKWlunUlTbgqjGs0LujvvWjNipKMQSXRQipVFJ5PT0TjNTaq1Yj3oRkaCAUAtMAxHipX2qqzdRNxDoetN7h1Z68YICNujmBjdcZ8aT93sNqxMKXwBgsKW6LPlez",
    :expires_at=>1526543399,
    :expires=>true
  },
  :extra=>{
    :raw_info=>{
      :resultcode=>"00",
      :message=>"success",
      :response=>{
        :id=>"48436401",
        :nickname=>"길동",
        :profile_image=>"https://phinf.pstatic.net/contactthumb/52/2014/8/4/kimsuerim_1407162661934.jpg",
        :age=>"30-39",
        :gender=>"M",
        :email=>"[email protected]",
        :name=>"홍길동",
        :birthday=>"01-08"
      }
    }
  }
}

Contributing

  1. Fork it ( https://github.com/kimsuelim/omniauth-naver/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

omniauth-naver's People

Contributors

kimsuelim avatar

Stargazers

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

Watchers

 avatar  avatar

omniauth-naver's Issues

raw_properties['gender'] Issue

private method의 gender 부분에서, gender property 를 요청하지 않으면 raw_properties['gender'] 가 nilClass error 를 발생시킵니다. 해당 부분에 대해서 if raw_properties['gender'].present? && raw_properties['gender'].include? 'M'
라는지 검증을 한 번 더 거쳐야 할 것 같습니다

def gender
return 'male' if raw_properties['gender'].include? 'M'
return 'female' if raw_properties['gender'].include? 'F'
end

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.