omniauth-dropbox-oauth2-sv 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +3 -0
- data/README.md +3 -0
- data/lib/omniauth-dropbox-oauth2.rb +1 -0
- data/lib/omniauth/dropbox_oauth2.rb +1 -0
- data/lib/omniauth/dropbox_oauth2/version.rb +5 -0
- data/lib/omniauth/strategies/dropbox_oauth2.rb +52 -0
- data/lib/tasks/.keep +0 -0
- data/omniauth-dropbox-oauth2-sv.gemspec +23 -0
- metadata +78 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: d122df67eecf7e258ca117e18b414da769f1853e
|
4
|
+
data.tar.gz: 57ab2e901c56efb18ed09673690027e331938874
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 516a25c659c6b9240bb6854bc57d98b25e2bbfa520036c28981ac5a4f7255e75c2aba3244e3e0df8bcf2bcc60560ebcff96204eba949d4b16e6e9fd8d2ce40c9
|
7
|
+
data.tar.gz: 7529820109b72ce6403618355ef38cb5b6d27c9c2665e6e4e3da768d60d8457801a57e63773b0ab069099f6293970540c1f7e862a8abe65950f6772cacf9f1af
|
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require File.join('omniauth', 'dropbox_oauth2')
|
@@ -0,0 +1 @@
|
|
1
|
+
require File.join('omniauth', 'strategies', 'dropbox_oauth2')
|
@@ -0,0 +1,52 @@
|
|
1
|
+
require 'omniauth-oauth2'
|
2
|
+
|
3
|
+
module OmniAuth
|
4
|
+
module Strategies
|
5
|
+
class DropboxOauth2 < OmniAuth::Strategies::OAuth2
|
6
|
+
option :name, "dropbox_oauth2"
|
7
|
+
option :client_options, {
|
8
|
+
:site => 'https://api.dropbox.com',
|
9
|
+
:authorize_url => 'https://www.dropbox.com/oauth2/authorize',
|
10
|
+
:token_url => 'https://api.dropbox.com/oauth2/token'
|
11
|
+
}
|
12
|
+
|
13
|
+
uid { raw_info['uid'] }
|
14
|
+
|
15
|
+
info do
|
16
|
+
{
|
17
|
+
'uid' => raw_info['account_id'],
|
18
|
+
'name' => raw_info['name']['display_name'],
|
19
|
+
'email' => raw_info['email']
|
20
|
+
}
|
21
|
+
end
|
22
|
+
|
23
|
+
extra do
|
24
|
+
{ 'raw_info' => raw_info }
|
25
|
+
end
|
26
|
+
|
27
|
+
def raw_info
|
28
|
+
conn = Faraday.new(:url => 'https://api.dropbox.com') do |faraday|
|
29
|
+
faraday.request :url_encoded # form-encode POST params
|
30
|
+
faraday.response :logger # log requests to STDOUT
|
31
|
+
faraday.adapter Faraday.default_adapter # make requests with Net::HTTP
|
32
|
+
end
|
33
|
+
response = conn.post do |req|
|
34
|
+
req.url '/2/users/get_current_account'
|
35
|
+
req.headers['Content-Type'] = 'application/json'
|
36
|
+
req.headers['Authorization'] = "Bearer #{access_token.token}"
|
37
|
+
req.body = "null"
|
38
|
+
end
|
39
|
+
@raw_info ||= MultiJson.decode(response.body)
|
40
|
+
# @raw_info ||= MultiJson.decode(access_token.get('/2/users/get_current_account').body)
|
41
|
+
end
|
42
|
+
|
43
|
+
def callback_url
|
44
|
+
if @authorization_code_from_signed_request
|
45
|
+
''
|
46
|
+
else
|
47
|
+
options[:callback_url] || super
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
data/lib/tasks/.keep
ADDED
File without changes
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require File.expand_path(File.join('..', 'lib', 'omniauth', 'dropbox_oauth2', 'version'), __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |gem|
|
5
|
+
gem.name = 'omniauth-dropbox-oauth2-sv'
|
6
|
+
gem.version = OmniAuth::DropboxOauth2::VERSION
|
7
|
+
gem.homepage = 'https://github.com/smallvictories/omniauth-dropbox-oauth2'
|
8
|
+
|
9
|
+
gem.author = 'Small Victories'
|
10
|
+
gem.email = 'hello@smallvictori.es'
|
11
|
+
gem.description = 'Dropbox OAuth2 strategy for OmniAuth 1.x'
|
12
|
+
gem.summary = gem.description
|
13
|
+
|
14
|
+
gem.add_dependency "omniauth-oauth2", "~> 1.3.1"
|
15
|
+
|
16
|
+
gem.add_development_dependency 'rake'
|
17
|
+
|
18
|
+
gem.executables = `git ls-files -- bin/*`.split("\n").map{|f| File.basename(f)}
|
19
|
+
gem.files = `git ls-files`.split("\n")
|
20
|
+
gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
21
|
+
|
22
|
+
gem.require_paths = ['lib']
|
23
|
+
end
|
metadata
ADDED
@@ -0,0 +1,78 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: omniauth-dropbox-oauth2-sv
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.4.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Small Victories
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-06-17 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: omniauth-oauth2
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 1.3.1
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 1.3.1
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
description: Dropbox OAuth2 strategy for OmniAuth 1.x
|
42
|
+
email: hello@smallvictori.es
|
43
|
+
executables: []
|
44
|
+
extensions: []
|
45
|
+
extra_rdoc_files: []
|
46
|
+
files:
|
47
|
+
- Gemfile
|
48
|
+
- README.md
|
49
|
+
- lib/omniauth-dropbox-oauth2.rb
|
50
|
+
- lib/omniauth/dropbox_oauth2.rb
|
51
|
+
- lib/omniauth/dropbox_oauth2/version.rb
|
52
|
+
- lib/omniauth/strategies/dropbox_oauth2.rb
|
53
|
+
- lib/tasks/.keep
|
54
|
+
- omniauth-dropbox-oauth2-sv.gemspec
|
55
|
+
homepage: https://github.com/smallvictories/omniauth-dropbox-oauth2
|
56
|
+
licenses: []
|
57
|
+
metadata: {}
|
58
|
+
post_install_message:
|
59
|
+
rdoc_options: []
|
60
|
+
require_paths:
|
61
|
+
- lib
|
62
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
63
|
+
requirements:
|
64
|
+
- - ">="
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: '0'
|
67
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
68
|
+
requirements:
|
69
|
+
- - ">="
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
version: '0'
|
72
|
+
requirements: []
|
73
|
+
rubyforge_project:
|
74
|
+
rubygems_version: 2.6.8
|
75
|
+
signing_key:
|
76
|
+
specification_version: 4
|
77
|
+
summary: Dropbox OAuth2 strategy for OmniAuth 1.x
|
78
|
+
test_files: []
|