omniauth-fortnox-oauth2 0.0.2 → 0.0.3
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 +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +11 -0
- data/lib/omniauth/fortnox_oauth2/version.rb +1 -1
- data/lib/omniauth/strategies/fortnox_oauth2.rb +12 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e867e1c0804b077222e57ec5d0bb96da3fcc642047b435949b65783dcec3e177
|
4
|
+
data.tar.gz: 465953deef868451d8670e3056d99a8ce38c8bb1ba5904dd2d5ec05cf3ab57ab
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c38c7b304242bcf94d265e29a5c42e59e223ccaa790105eddc0b09b63190768fa61eb99a9798ea26d5e83180f91a1a1cc4c31b425f1191ed1923ee9bd59f6260
|
7
|
+
data.tar.gz: 43a72b8c8ce885db697f5a8bf0702a4549fe28b956f3f55e3bea76965168acbbfaf3ad53ec011235b5f347c097d9d73aa74233758eac5d1567234130d4bc85e3
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -79,6 +79,17 @@ You can also configure the `client_options` by passing in any of the following s
|
|
79
79
|
|
80
80
|
* `token_method`: Override the token_method used by the gem, default `:post`.
|
81
81
|
|
82
|
+
## Note
|
83
|
+
Currently the only way to support multiple redirect uri's in Fortnox is to add them sperated using ` ` (space). This will work for the initial request to get the authorization code.
|
84
|
+
When trading the code for a token the `redirect_uri` will be matched using the string used in Fortnox developer portal. This is beeing changed but for now the workaround is to pass that string.
|
85
|
+
This can here be passed as an option `fortnox_redirect_uri`, it can contain one or multiple uri's.
|
86
|
+
This will need to exactly match the string in Fortnox.
|
87
|
+
|
88
|
+
For example:
|
89
|
+
```ruby
|
90
|
+
env['omniauth.strategy'].options[:fortnox_redirect_uri] = 'https://test.test/callback https://second-test.test/callback'
|
91
|
+
```
|
92
|
+
|
82
93
|
## Auth Hash
|
83
94
|
|
84
95
|
Here's an example of an authentication hash available in the callback by accessing `request.env['omniauth.auth']`:
|
@@ -20,6 +20,7 @@ module OmniAuth
|
|
20
20
|
|
21
21
|
option :authorize_options, %i[scope state account_type]
|
22
22
|
option :provider_ignores_state, false
|
23
|
+
option :fortnox_redirect_uri, nil
|
23
24
|
|
24
25
|
uid { raw_info['CompanyInformation']['OrganizationNumber'] }
|
25
26
|
|
@@ -66,11 +67,21 @@ module OmniAuth
|
|
66
67
|
options[:callback_url] || (full_host + script_name + callback_path)
|
67
68
|
end
|
68
69
|
|
70
|
+
# Currently the only way to support multiple redirect uri's in Fortnox
|
71
|
+
# is to add them sperated using ` ` (space). This will work for the
|
72
|
+
# initial request to get the authorization code.
|
73
|
+
# When trading the code for a token the `redirect_uri` will be matched
|
74
|
+
# using the string entered in Fortnox developer portal. This is beeing
|
75
|
+
# changed but for now the workaround is to pass that string.
|
76
|
+
# It can contain one or multiple uri's.
|
77
|
+
#
|
69
78
|
def build_access_token
|
79
|
+
redirect_uri = options.fortnox_redirect_uri || callback_url
|
70
80
|
verifier = request.params['code']
|
81
|
+
|
71
82
|
client.auth_code.get_token(
|
72
83
|
verifier,
|
73
|
-
{ redirect_uri:
|
84
|
+
{ redirect_uri: redirect_uri }.merge(token_params.to_hash(symbolize_keys: true)),
|
74
85
|
deep_symbolize(options.auth_token_params)
|
75
86
|
)
|
76
87
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omniauth-fortnox-oauth2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- svenne87
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-05-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: omniauth-oauth2
|