omniauth-notion 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a7057268fd4eba2d5620dfd38f94411d46f580e767c7555e4a9fbaeada9e96c8
4
- data.tar.gz: 2f85909e5bdedc3d057dda1740175317df0bc59b8dd5c14a345e64188ea2ff65
3
+ metadata.gz: cda4c0f8b266a70db2d2e46d543fbcc9ec9c2fc4ce5bf84a5af5d4f7e076bda7
4
+ data.tar.gz: ef501a338060cc59de200956c539b6cf2e685511ad45d3cc86ac7b3e661255b4
5
5
  SHA512:
6
- metadata.gz: 9bad6a2501283f4cb7992f2729afee24580861fc2094f721be081567aa84b61a014ad9f21fd495eec69725f76cf6bd51231ba2434d0066b56780f4464d30c57a
7
- data.tar.gz: cc1831fac34ca7cc1753c044acb6d623f5d891d0ec5eed13bacb771d20dd0eb1c1228efce5741e624859c7e23765bb949bed606356e3aa1ee7c564eb267e56ab
6
+ metadata.gz: 220eb10e5ffc947209f84c3dfbf809fc9761a0f4d9359cbad8889247941f564a652458eed3316100a2be3607da2b902f52acdcbe5d21ccac89740be73c1aebc1
7
+ data.tar.gz: c45865f7f27de90bed1027cb68b4f85c00b975a7cd7a4447f238bf7f76f31e6656afb2e4f1aa3ae5e0979b5bfba7a7de4a2444d90ff69d3f428e2449f7bd76e4
@@ -0,0 +1,38 @@
1
+ ---
2
+ name: Bug report
3
+ about: Create a report to help us improve
4
+ title: ''
5
+ labels: ''
6
+ assignees: ''
7
+
8
+ ---
9
+
10
+ **Describe the bug**
11
+ A clear and concise description of what the bug is.
12
+
13
+ **To Reproduce**
14
+ Steps to reproduce the behavior:
15
+ 1. Go to '...'
16
+ 2. Click on '....'
17
+ 3. Scroll down to '....'
18
+ 4. See error
19
+
20
+ **Expected behavior**
21
+ A clear and concise description of what you expected to happen.
22
+
23
+ **Screenshots**
24
+ If applicable, add screenshots to help explain your problem.
25
+
26
+ **Desktop (please complete the following information):**
27
+ - OS: [e.g. iOS]
28
+ - Browser [e.g. chrome, safari]
29
+ - Version [e.g. 22]
30
+
31
+ **Smartphone (please complete the following information):**
32
+ - Device: [e.g. iPhone6]
33
+ - OS: [e.g. iOS8.1]
34
+ - Browser [e.g. stock browser, safari]
35
+ - Version [e.g. 22]
36
+
37
+ **Additional context**
38
+ Add any other context about the problem here.
@@ -0,0 +1,20 @@
1
+ ---
2
+ name: Feature request
3
+ about: Suggest an idea for this project
4
+ title: ''
5
+ labels: ''
6
+ assignees: ''
7
+
8
+ ---
9
+
10
+ **Is your feature request related to a problem? Please describe.**
11
+ A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
12
+
13
+ **Describe the solution you'd like**
14
+ A clear and concise description of what you want to happen.
15
+
16
+ **Describe alternatives you've considered**
17
+ A clear and concise description of any alternative solutions or features you've considered.
18
+
19
+ **Additional context**
20
+ Add any other context or screenshots about the feature request here.
data/.gitignore CHANGED
@@ -15,3 +15,4 @@ spec/reports
15
15
  test/tmp
16
16
  test/version_tmp
17
17
  tmp
18
+ .idea
@@ -0,0 +1,128 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our
6
+ community a harassment-free experience for everyone, regardless of age, body
7
+ size, visible or invisible disability, ethnicity, sex characteristics, gender
8
+ identity and expression, level of experience, education, socio-economic status,
9
+ nationality, personal appearance, race, religion, or sexual identity
10
+ and orientation.
11
+
12
+ We pledge to act and interact in ways that contribute to an open, welcoming,
13
+ diverse, inclusive, and healthy community.
14
+
15
+ ## Our Standards
16
+
17
+ Examples of behavior that contributes to a positive environment for our
18
+ community include:
19
+
20
+ * Demonstrating empathy and kindness toward other people
21
+ * Being respectful of differing opinions, viewpoints, and experiences
22
+ * Giving and gracefully accepting constructive feedback
23
+ * Accepting responsibility and apologizing to those affected by our mistakes,
24
+ and learning from the experience
25
+ * Focusing on what is best not just for us as individuals, but for the
26
+ overall community
27
+
28
+ Examples of unacceptable behavior include:
29
+
30
+ * The use of sexualized language or imagery, and sexual attention or
31
+ advances of any kind
32
+ * Trolling, insulting or derogatory comments, and personal or political attacks
33
+ * Public or private harassment
34
+ * Publishing others' private information, such as a physical or email
35
+ address, without their explicit permission
36
+ * Other conduct which could reasonably be considered inappropriate in a
37
+ professional setting
38
+
39
+ ## Enforcement Responsibilities
40
+
41
+ Community leaders are responsible for clarifying and enforcing our standards of
42
+ acceptable behavior and will take appropriate and fair corrective action in
43
+ response to any behavior that they deem inappropriate, threatening, offensive,
44
+ or harmful.
45
+
46
+ Community leaders have the right and responsibility to remove, edit, or reject
47
+ comments, commits, code, wiki edits, issues, and other contributions that are
48
+ not aligned to this Code of Conduct, and will communicate reasons for moderation
49
+ decisions when appropriate.
50
+
51
+ ## Scope
52
+
53
+ This Code of Conduct applies within all community spaces, and also applies when
54
+ an individual is officially representing the community in public spaces.
55
+ Examples of representing our community include using an official e-mail address,
56
+ posting via an official social media account, or acting as an appointed
57
+ representative at an online or offline event.
58
+
59
+ ## Enforcement
60
+
61
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
62
+ reported to the community leaders responsible for enforcement at
63
+ jeremiahchurch@gmail.com.
64
+ All complaints will be reviewed and investigated promptly and fairly.
65
+
66
+ All community leaders are obligated to respect the privacy and security of the
67
+ reporter of any incident.
68
+
69
+ ## Enforcement Guidelines
70
+
71
+ Community leaders will follow these Community Impact Guidelines in determining
72
+ the consequences for any action they deem in violation of this Code of Conduct:
73
+
74
+ ### 1. Correction
75
+
76
+ **Community Impact**: Use of inappropriate language or other behavior deemed
77
+ unprofessional or unwelcome in the community.
78
+
79
+ **Consequence**: A private, written warning from community leaders, providing
80
+ clarity around the nature of the violation and an explanation of why the
81
+ behavior was inappropriate. A public apology may be requested.
82
+
83
+ ### 2. Warning
84
+
85
+ **Community Impact**: A violation through a single incident or series
86
+ of actions.
87
+
88
+ **Consequence**: A warning with consequences for continued behavior. No
89
+ interaction with the people involved, including unsolicited interaction with
90
+ those enforcing the Code of Conduct, for a specified period of time. This
91
+ includes avoiding interactions in community spaces as well as external channels
92
+ like social media. Violating these terms may lead to a temporary or
93
+ permanent ban.
94
+
95
+ ### 3. Temporary Ban
96
+
97
+ **Community Impact**: A serious violation of community standards, including
98
+ sustained inappropriate behavior.
99
+
100
+ **Consequence**: A temporary ban from any sort of interaction or public
101
+ communication with the community for a specified period of time. No public or
102
+ private interaction with the people involved, including unsolicited interaction
103
+ with those enforcing the Code of Conduct, is allowed during this period.
104
+ Violating these terms may lead to a permanent ban.
105
+
106
+ ### 4. Permanent Ban
107
+
108
+ **Community Impact**: Demonstrating a pattern of violation of community
109
+ standards, including sustained inappropriate behavior, harassment of an
110
+ individual, or aggression toward or disparagement of classes of individuals.
111
+
112
+ **Consequence**: A permanent ban from any sort of public interaction within
113
+ the community.
114
+
115
+ ## Attribution
116
+
117
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage],
118
+ version 2.0, available at
119
+ https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
120
+
121
+ Community Impact Guidelines were inspired by [Mozilla's code of conduct
122
+ enforcement ladder](https://github.com/mozilla/diversity).
123
+
124
+ [homepage]: https://www.contributor-covenant.org
125
+
126
+ For answers to common questions about this code of conduct, see the FAQ at
127
+ https://www.contributor-covenant.org/faq. Translations are available at
128
+ https://www.contributor-covenant.org/translations.
@@ -14,7 +14,13 @@ module OmniAuth
14
14
  site: 'https://api.notion.com/v1',
15
15
  authorize_url: 'https://api.notion.com/v1/oauth/authorize',
16
16
  token_url: 'https://api.notion.com/v1/oauth/token',
17
- connection_opts: { headers: { user_agent: 'Omniauth-notion', accept: 'application/json', content_type: 'application/json' } }
17
+ connection_opts: {
18
+ headers: {
19
+ user_agent: 'Omniauth-notion',
20
+ accept: 'application/json',
21
+ content_type: 'application/json',
22
+ },
23
+ }
18
24
 
19
25
  # These are called after authentication has succeeded. If
20
26
  # possible, you should try to set the UID without making
@@ -38,18 +44,41 @@ module OmniAuth
38
44
  }
39
45
  end
40
46
 
47
+ # The Notion API requires HTTP Basic Authentication when exchanging the
48
+ # code for a token (i.e. when POSTing to /v1/oauth/token)
49
+ # Notion Docs: https://developers.notion.com/docs/authorization#exchanging-the-grant-for-an-access-token
50
+ # Similar solution: https://gist.github.com/handylearn/6d6125263d32544c2057#file-filab_strategy-rb-L35
51
+ def build_access_token
52
+ options.token_params.merge!(
53
+ headers: { 'Authorization' => basic_auth_header },
54
+ )
55
+ super
56
+ end
57
+
58
+ def basic_auth_header
59
+ "Basic " + Base64.strict_encode64("#{options[:client_id]}:#{options[:client_secret]}")
60
+ end
61
+
62
+ # The Notion API gives us some core data as part of the token response. I
63
+ # don't think there is a separate /user/me endpoint (at least as of May
64
+ # 2021). Also, we get a `bot_id`, not a real user ID. We do get some
65
+ # informaton about the connector Organization, however.
41
66
  def raw_info
42
- @raw_info ||= access_token.post('v1/oauth/token', body: nil.to_json).parsed
67
+ @raw_info ||= access_token.params.except('access_token', 'bearer')
43
68
  end
44
69
 
45
70
  def callback_url
46
- if @authorization_code_from_signed_request
47
- ''
48
- else
49
- options[:callback_url] || super
50
- end
71
+ full_host + script_name + callback_path
51
72
  end
52
73
 
74
+ # def callback_url
75
+ # if @authorization_code_from_signed_request
76
+ # ''
77
+ # else
78
+ # options[:callback_url] || super
79
+ # end
80
+ # end
81
+
53
82
  # def callback_url
54
83
  # # If redirect_uri is configured in token_params, use that
55
84
  # # value.
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Omniauth
4
4
  module Notion
5
- VERSION = "0.0.1"
5
+ VERSION = "0.0.2"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-notion
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeremiah Church
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-05-13 00:00:00.000000000 Z
11
+ date: 2021-05-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: omniauth
@@ -31,12 +31,10 @@ executables: []
31
31
  extensions: []
32
32
  extra_rdoc_files: []
33
33
  files:
34
+ - ".github/ISSUE_TEMPLATE/bug_report.md"
35
+ - ".github/ISSUE_TEMPLATE/feature_request.md"
34
36
  - ".gitignore"
35
- - ".idea/.gitignore"
36
- - ".idea/misc.xml"
37
- - ".idea/modules.xml"
38
- - ".idea/omniauth-notion.iml"
39
- - ".idea/vcs.xml"
37
+ - CODE_OF_CONDUCT.md
40
38
  - Gemfile
41
39
  - LICENSE.txt
42
40
  - README.md
@@ -63,7 +61,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
63
61
  - !ruby/object:Gem::Version
64
62
  version: '0'
65
63
  requirements: []
66
- rubygems_version: 3.0.3
64
+ rubygems_version: 3.2.3
67
65
  signing_key:
68
66
  specification_version: 4
69
67
  summary: OmniAuth strategy for Notion using OAuth2
data/.idea/.gitignore DELETED
@@ -1,8 +0,0 @@
1
- # Default ignored files
2
- /shelf/
3
- /workspace.xml
4
- # Datasource local storage ignored files
5
- /dataSources/
6
- /dataSources.local.xml
7
- # Editor-based HTTP Client requests
8
- /httpRequests/
data/.idea/misc.xml DELETED
@@ -1,4 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="ProjectRootManager" version="2" project-jdk-name="rbenv: 2.6.6" project-jdk-type="RUBY_SDK" />
4
- </project>
data/.idea/modules.xml DELETED
@@ -1,8 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="ProjectModuleManager">
4
- <modules>
5
- <module fileurl="file://$PROJECT_DIR$/.idea/omniauth-notion.iml" filepath="$PROJECT_DIR$/.idea/omniauth-notion.iml" />
6
- </modules>
7
- </component>
8
- </project>
@@ -1,24 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <module type="RUBY_MODULE" version="4">
3
- <component name="ModuleRunConfigurationManager">
4
- <shared />
5
- </component>
6
- <component name="NewModuleRootManager">
7
- <content url="file://$MODULE_DIR$">
8
- <sourceFolder url="file://$MODULE_DIR$/features" isTestSource="true" />
9
- <sourceFolder url="file://$MODULE_DIR$/spec" isTestSource="true" />
10
- <sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />
11
- </content>
12
- <orderEntry type="inheritedJdk" />
13
- <orderEntry type="sourceFolder" forTests="false" />
14
- <orderEntry type="library" scope="PROVIDED" name="bundler (v2.2.15, rbenv: 2.6.6) [gem]" level="application" />
15
- <orderEntry type="library" scope="PROVIDED" name="hashie (v4.1.0, rbenv: 2.6.6) [gem]" level="application" />
16
- <orderEntry type="library" scope="PROVIDED" name="omniauth (v1.9.1, rbenv: 2.6.6) [gem]" level="application" />
17
- <orderEntry type="library" scope="PROVIDED" name="rack (v2.2.3, rbenv: 2.6.6) [gem]" level="application" />
18
- </component>
19
- <component name="RakeTasksCache">
20
- <option name="myRootTask">
21
- <RakeTaskImpl id="rake" />
22
- </option>
23
- </component>
24
- </module>
data/.idea/vcs.xml DELETED
@@ -1,6 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="VcsDirectoryMappings">
4
- <mapping directory="$PROJECT_DIR$" vcs="Git" />
5
- </component>
6
- </project>