omniauth-onshape-oauth2 0.1.3 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +13 -1
- data/lib/omniauth-onshape-oauth2/version.rb +1 -1
- data/lib/omniauth/strategies/onshape.rb +12 -8
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 64bedec6a3d460681e1f3fb0a086c8ca1756491c
|
4
|
+
data.tar.gz: 4fdfe55d40b2535889534538d3d5ac750effcee9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 746fec29b9bdf6024c2b9d82003657107847dfbe896825cdddd938672775d544b3640a61a0a24a50a2e4e94e79ad2cfa48c4e2ca5387fc94a7c133ddb559338e
|
7
|
+
data.tar.gz: 6bb908e693487d07e96efbc711d87c81054ab7b964dddfb2e1d35e48b01528b28de48bbcb1c788ead7060cff36d14042a709b35a89c3c0f196adf35e0b8939c2
|
data/README.md
CHANGED
@@ -29,9 +29,21 @@ Rails.application.config.middleware.use OmniAuth::Builder do
|
|
29
29
|
provider :onshape, ENV['ONSHAPE_KEY'], ENV['ONSHAPE_SECRET']
|
30
30
|
end
|
31
31
|
```
|
32
|
+
|
32
33
|
You can now access the OmniAuth onShape OAuth2 URL: `/auth/onshape`.
|
33
34
|
|
34
|
-
|
35
|
+
For testing, you can access the partner dev server, which has a different strategy, by passing the options directly:
|
36
|
+
|
37
|
+
```ruby
|
38
|
+
Rails.application.config.middleware.use OmniAuth::Builder do
|
39
|
+
provider :onshape, ENV['ONSHAPE_KEY'], ENV['ONSHAPE_SECRET'],
|
40
|
+
:setup => lambda{|env|
|
41
|
+
env['omniauth.strategy'].options[:client_options].site = 'https://partner.dev.onshape.com/api';
|
42
|
+
env['omniauth.strategy'].options[:client_options].authorize_url = 'https://partner.dev.onshape.com/oauth/authorize';
|
43
|
+
env['omniauth.strategy'].options[:client_options].token_url = 'https://partner.dev.onshape.com/oauth/token';
|
44
|
+
}
|
45
|
+
end
|
46
|
+
```
|
35
47
|
|
36
48
|
## Granting Member Permissions to Your Application
|
37
49
|
|
@@ -2,17 +2,17 @@ require 'omniauth-oauth2'
|
|
2
2
|
|
3
3
|
module OmniAuth
|
4
4
|
module Strategies
|
5
|
-
class
|
5
|
+
class OnShape < OmniAuth::Strategies::OAuth2
|
6
6
|
# Give your strategy a name.
|
7
|
-
option :name, '
|
7
|
+
option :name, 'onshape'
|
8
8
|
|
9
9
|
# This is where you pass the options you would pass when
|
10
10
|
# initializing your consumer from the OAuth gem.
|
11
11
|
option :client_options, {
|
12
|
-
:site => 'https://
|
13
|
-
:authorize_url => 'https://
|
14
|
-
:token_url => 'https://
|
15
|
-
}
|
12
|
+
:site => 'https://cad.onshape.com/api',
|
13
|
+
:authorize_url => 'https://oauth.onshape.com/oauth/authorize',
|
14
|
+
:token_url => 'https://oauth.onshape.com/oauth/token'
|
15
|
+
}
|
16
16
|
|
17
17
|
# option :scope, 'r_basicprofile r_emailaddress'
|
18
18
|
# option :fields, ['id', 'email-address', 'first-name', 'last-name', 'headline', 'location', 'industry', 'picture-url', 'public-profile-url']
|
@@ -27,7 +27,11 @@ module OmniAuth
|
|
27
27
|
info do
|
28
28
|
{
|
29
29
|
:name => raw_info['name'],
|
30
|
-
:
|
30
|
+
:firstName => raw_info['firstName'],
|
31
|
+
:lastName => raw_info['lastName'],
|
32
|
+
:email => raw_info['email'],
|
33
|
+
:image => raw_info['image'],
|
34
|
+
:url => raw_info['href'],
|
31
35
|
}
|
32
36
|
end
|
33
37
|
|
@@ -43,4 +47,4 @@ module OmniAuth
|
|
43
47
|
end
|
44
48
|
end
|
45
49
|
|
46
|
-
OmniAuth.config.add_camelization '
|
50
|
+
OmniAuth.config.add_camelization 'onshape', 'OnShape'
|