
Security News
Rspack Introduces Rslint, a TypeScript-First Linter Written in Go
Rspack launches Rslint, a fast TypeScript-first linter built on typescript-go, joining in on the trend of toolchains creating their own linters.
omniauth-douban-oauth2
Advanced tools
This is the OmniAuth strategy for authenticating to Douban. To use it, you'll need to sign up for an OAuth2 Application Key and Secret on the Open Platform
gem install omniauth-douban-oauth2
use OmniAuth::Builder do
provider :douban, ENV['DOUBAN_KEY'], ENV['DOUBAN_SECRET']
end
Rails + Devise + Omniauth-douban-oauth2
require 'sinatra'
require 'omniauth-douban-oauth2'
KEY = 'your api key'
SECRET = 'your api secret'
use Rack::Session::Cookie
use OmniAuth::Builder do
provider :douban, KEY, SECRET
end
get '/' do
'<a href="/auth/douban">Douban</a>'
end
get '/auth/douban/callback' do
auth = env['omniauth.auth']
auth.to_hash.to_s
end
get '/auth/failure' do
'auth failure'
end
Here's an example Auth Hash available in request.env['omniauth.auth']
:
{
"provider" => "douban",
"uid" => "2217855",
"info" => {
"name" => "小松其实还没有",
"nickname" => "xiaosong",
"location" => "陕西西安",
"image" => "http://img3.douban.com/icon/u2217855-34.jpg",
"urls" => { :alt => "http://www.douban.com/people/xiaosong/" },
"description" => "你确实知道就必须证明",
},
"credentials" => {
"token" => "6516f0d........", # OAuth 2.0 access_token
"refresh_token" => "30c8c560..........", # OAuth 2.0 refresh_token
"expires_at" => 1357053699, # when the access token expires (it always will)
"expires" => true # this will always be true
},
"extra" => {
"raw_info" => {
"loc_id" => "118371",
"name" => "小松其实还没有",
"created" => "2008-02-05 15:26:44",
"loc_name" => "陕西西安",
"avatar" => "http://img3.douban.com/icon/u2217855-34.jpg",
"signature" => "啊我要增肥...",
"uid" => "xiaosong",
"alt" => "http://www.douban.com/people/xiaosong/",
"id" => "2217855",
"desc" => "你确实知道就必须证明"
}
}
}
FAQs
Unknown package
We found that omniauth-douban-oauth2 demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Rspack launches Rslint, a fast TypeScript-first linter built on typescript-go, joining in on the trend of toolchains creating their own linters.
Security News
Hacker Demonstrates How Easy It Is To Steal Data From Popular Password Managers
Security News
Oxlint’s new preview brings type-aware linting powered by typescript-go, combining advanced TypeScript rules with native-speed performance.