workos 0.9.2 → 0.10.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (27) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +4 -0
  3. data/Gemfile.lock +2 -2
  4. data/README.md +15 -15
  5. data/docs/WorkOS/SSO.html +235 -235
  6. data/docs/file.README.html +20 -20
  7. data/lib/workos/client.rb +22 -1
  8. data/lib/workos/passwordless.rb +0 -2
  9. data/lib/workos/portal.rb +0 -6
  10. data/lib/workos/profile.rb +2 -2
  11. data/lib/workos/sso.rb +119 -13
  12. data/lib/workos/version.rb +1 -1
  13. data/spec/lib/workos/sso_spec.rb +198 -7
  14. data/spec/support/fixtures/vcr_cassettes/audit_trail/get_events.yml +2 -2
  15. data/spec/support/fixtures/vcr_cassettes/directory_sync/list_directories.yml +1 -1
  16. data/spec/support/fixtures/vcr_cassettes/directory_sync/list_directories_with_domain_param.yml +1 -1
  17. data/spec/support/fixtures/vcr_cassettes/sso/delete_connection_with_invalid_id.yml +72 -0
  18. data/spec/support/fixtures/vcr_cassettes/sso/delete_connection_with_valid_id.yml +70 -0
  19. data/spec/support/fixtures/vcr_cassettes/sso/get_connection_with_invalid_id.yml +72 -0
  20. data/spec/support/fixtures/vcr_cassettes/sso/get_connection_with_valid_id.yml +74 -0
  21. data/spec/support/fixtures/vcr_cassettes/sso/list_connections.yml +72 -0
  22. data/spec/support/fixtures/vcr_cassettes/sso/list_connections_with_after_param.yml +72 -0
  23. data/spec/support/fixtures/vcr_cassettes/sso/list_connections_with_before_param.yml +73 -0
  24. data/spec/support/fixtures/vcr_cassettes/sso/list_connections_with_connection_type_param.yml +72 -0
  25. data/spec/support/fixtures/vcr_cassettes/sso/list_connections_with_domain_param.yml +72 -0
  26. data/spec/support/fixtures/vcr_cassettes/sso/list_connections_with_limit_param.yml +72 -0
  27. metadata +23 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f72ed378ff8e20a866b38dae789600e327a166d8278cff389a7f6475f4846404
4
- data.tar.gz: 55f0f218dc1d01745bff80b142ea13a96dd016a228cbd492483d15e6a84d77a2
3
+ metadata.gz: 72c11606b98be63db5dab6a2c68eb69cab12ce9f9afe20b73475ce6948b24794
4
+ data.tar.gz: c7ea54043041810b71e2390b3efe20152870d8617da9a48a9922c775fb01f5d4
5
5
  SHA512:
6
- metadata.gz: 5c291aa09e469c0ed3d39ed421f3ea1061b6d45edcdbc6dab6525ea01b5568063818ea5bcfc16e54a76286afe427380710da4d51300f087fded2932138c24648
7
- data.tar.gz: 9b3d79b06bdb13aba050c3bf4ed11c6970f5ccffcc5fe14c6fcceb70ea0bcd98860f7d228fa04333df0b38045f5b407fccad2d7ab139f9f2f39a10611a602ef1
6
+ metadata.gz: 8721f09bdcabce0772ffd6218b11859bbbdddb096f7d85c1b56b1f1b28816b8e2d86ef45838311e37c5c7bb322ffb2836d4ff355d8268ee15bbfcded71f1f658
7
+ data.tar.gz: 74b8126bedbd7c2f36da24376af99f2502d5ba3ac062c9067515d1fa6c5c402684ae0c6a3d2cfa42ee0ea61cbf75329b861a6362aa8fd7af361e58f8fff0604d
data/.rubocop.yml CHANGED
@@ -10,8 +10,12 @@ Layout/LineLength:
10
10
  - '(\A|\s)/.*?/'
11
11
  Metrics/BlockLength:
12
12
  ExcludedMethods: ['describe', 'context']
13
+ Metrics/MethodLength:
14
+ Max: 15
13
15
  Metrics/ModuleLength:
14
16
  Max: 150
17
+ Metrics/ParameterLists:
18
+ Max: 6
15
19
  Style/TrailingCommaInArguments:
16
20
  EnforcedStyleForMultiline: 'consistent_comma'
17
21
  Style/TrailingCommaInHashLiteral:
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- workos (0.9.2)
4
+ workos (0.10.0)
5
5
  sorbet-runtime (~> 0.5)
6
6
 
7
7
  GEM
@@ -54,7 +54,7 @@ GEM
54
54
  simplecov-html (0.12.2)
55
55
  sorbet (0.5.5560)
56
56
  sorbet-static (= 0.5.5560)
57
- sorbet-runtime (0.5.6140)
57
+ sorbet-runtime (0.5.6189)
58
58
  sorbet-static (0.5.5560-universal-darwin-14)
59
59
  unicode-display_width (1.6.0)
60
60
  vcr (5.0.0)
data/README.md CHANGED
@@ -53,7 +53,7 @@ using the `WorkOS::SSO.get_profile` method.
53
53
  See our Ruby SSO example app for a [complete example](https://github.com/workos-inc/ruby-sso-example).
54
54
 
55
55
  ```ruby
56
- WorkOS::SSO.authorization_url(domain:, project_id:, redirect_uri:, state: {})
56
+ WorkOS::SSO.authorization_url(domain:, client_id:, redirect_uri:, state: {})
57
57
  ```
58
58
 
59
59
  > Generate an authorization URL to intitiate the WorkOS OAuth2 workflow.
@@ -61,25 +61,25 @@ WorkOS::SSO.authorization_url(domain:, project_id:, redirect_uri:, state: {})
61
61
  `WorkOS::SSO.authorization_url` accepts four arguments:
62
62
 
63
63
  - `domain` (string) — the authenticating user's company domain, without protocol (ex. `example.com`)
64
- - `project_id` (string) — your application's WorkOS [Project ID](https://dashboard.workos.com/sso/configuration) (ex. `project_01JG3BCPTRTSTTWQR4VSHXGWCQ`)
64
+ - `client_id` (string) — your application's WorkOS [Client ID](https://dashboard.workos.com/sso/configuration) (ex. `project_01JG3BCPTRTSTTWQR4VSHXGWCQ`)
65
65
  - `state` (optional, hash) — an optional hash used to manage state across authorization transactions (ex. `{ next_page: '/docs'}`)
66
- - `redirect_uri` (string) — a callback URL where your application redirects the user-agent after an authorization code is granted (ex. `workos.dev/callback`). This must match one of your configured callback URLs for the associated project on your WorkOS dashboard.
66
+ - `redirect_uri` (string) — a callback URL where your application redirects the user-agent after an authorization code is granted (ex. `workos.dev/callback`). This must match one of your configured callback URLs for the associated environment on your WorkOS dashboard.
67
67
 
68
68
  This method will return an OAuth2 query string of the form:
69
69
 
70
- `https://${domain}/sso/authorize?response_type=code&client_id=${projectID}&redirect_uri=${redirectURI}&state=${state}`
70
+ `https://${domain}/sso/authorize?response_type=code&client_id=${clientID}&redirect_uri=${redirectURI}&state=${state}`
71
71
 
72
72
  For example, when used in a [Sinatra app](http://sinatrarb.com/):
73
73
 
74
74
  ```ruby
75
75
  DOMAIN = 'example.com'
76
- PROJECT_ID = '{projectId}'
76
+ CLIENT_ID = '{clientId}'
77
77
  REDIRECT_URI = 'http://localhost:4567/callback'
78
78
 
79
79
  get '/auth' do
80
80
  authorization_url = WorkOS::SSO.authorization_url(
81
81
  domain: DOMAIN,
82
- project_id: PROJECT_ID,
82
+ client_id: CLIENT_ID,
83
83
  redirect_uri: REDIRECT_URI,
84
84
  )
85
85
 
@@ -89,14 +89,14 @@ end
89
89
 
90
90
  The user would be redirected to:
91
91
 
92
- `https://api.workos.com/sso/authorize?response_type=code&client_id={projectID}&redirect_uri=http://localhost:4567/callback`
92
+ `https://api.workos.com/sso/authorize?response_type=code&client_id={clientID}&redirect_uri=http://localhost:4567/callback`
93
93
 
94
94
  WorkOS takes over from here, sending the user to authenticate with their IDP, and on successful login, returns
95
95
  the user to your callback URL with a `code` parameter. You'll use `WorkOS::SSO.profile` to exchange the
96
96
  code for a `WorkOS::Profile`.
97
97
 
98
98
  ```ruby
99
- WorkOS::SSO.profile(code:, project_id:)
99
+ WorkOS::SSO.profile(code:, client_id:)
100
100
  ```
101
101
 
102
102
  > Fetch a WorkOS::Profile for an authorized user.
@@ -104,7 +104,7 @@ WorkOS::SSO.profile(code:, project_id:)
104
104
  `WorkOS::SSO.profile` accepts two arguments:
105
105
 
106
106
  - `code` (string) — an opaque string provided by the authorization server; will be exchanged for an Access Token when the user's profile is sent
107
- - `project_id` (string) — your application's WorkOS [Project ID](https://dashboard.workos.com/sso/configuration) (ex. `project_01JG3BCPTRTSTTWQR4VSHXGWCQ`)
107
+ - `client_id` (string) — your application's WorkOS [Client ID](https://dashboard.workos.com/sso/configuration) (ex. `project_01JG3BCPTRTSTTWQR4VSHXGWCQ`)
108
108
 
109
109
  This method will return an instance of a `WorkOS::Profile` with the following attributes:
110
110
 
@@ -131,13 +131,13 @@ Our Sinatra app can be extended to use this method:
131
131
 
132
132
  ```ruby
133
133
  DOMAIN = 'example.com'
134
- PROJECT_ID = '{projectId}'
134
+ CLIENT_ID = '{clientId}'
135
135
  REDIRECT_URI = 'http://localhost:4567/callback'
136
136
 
137
137
  get '/auth' do
138
138
  authorization_url = WorkOS::SSO.authorization_url(
139
139
  domain: DOMAIN,
140
- project_id: PROJECT_ID,
140
+ client_id: CLIENT_ID,
141
141
  redirect_uri: REDIRECT_URI,
142
142
  )
143
143
 
@@ -147,7 +147,7 @@ end
147
147
  get '/callback' do
148
148
  profile = WorkOS::SSO.profile(
149
149
  code: params['code'],
150
- project_id: PROJECT_ID,
150
+ client_id: CLIENT_ID,
151
151
  )
152
152
 
153
153
  session[:user] = profile.to_json
@@ -173,7 +173,7 @@ The user can then click on that link to be authenticated to your application.
173
173
  - `email` (string) - the email of the user to authenticate.
174
174
  - `type` (string) - The type of Passwordless Session to create. Currently, the only supported value is `MagicLink`.
175
175
  - `state` (optional, string) - Optional parameter that a Developer can choose to include in their authorization URL. If included, then the redirect URI received from WorkOS will contain the exact `state` that was passed in the authorization URL.
176
- - `redirect_uri` (string) - a callback URL where your application redirects the user-agent after an authorization code is granted (ex. `workos.dev/callback`). This must match one of your configured callback URLs for the associated project on your WorkOS dashboard.
176
+ - `redirect_uri` (string) - a callback URL where your application redirects the user-agent after an authorization code is granted (ex. `workos.dev/callback`). This must match one of your configured callback URLs for the associated environment on your WorkOS dashboard.
177
177
 
178
178
  This method will return a Passwordless Session object, containing the following attributes:
179
179
 
@@ -195,7 +195,7 @@ This method will return a boolean confirming the Magic Link was sent.
195
195
  Our Sinatra app can be altered to use Magic Link:
196
196
 
197
197
  ```ruby
198
- PROJECT_ID = '{projectId}'
198
+ CLIENT_ID = '{clientId}'
199
199
  REDIRECT_URI = 'http://localhost:4567/callback'
200
200
 
201
201
  post '/passwordless-auth' do
@@ -212,7 +212,7 @@ end
212
212
  get '/callback' do
213
213
  profile = WorkOS::SSO.profile(
214
214
  code: params['code'],
215
- project_id: PROJECT_ID,
215
+ client_id: CLIENT_ID,
216
216
  )
217
217
 
218
218
  session[:user] = profile.to_json
data/docs/WorkOS/SSO.html CHANGED
@@ -5,9 +5,9 @@
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
6
  <title>
7
7
  Module: WorkOS::SSO
8
-
8
+
9
9
  &mdash; Documentation by YARD 0.9.22
10
-
10
+
11
11
  </title>
12
12
 
13
13
  <link rel="stylesheet" href="../css/style.css" type="text/css" />
@@ -35,16 +35,16 @@
35
35
  <div id="main" tabindex="-1">
36
36
  <div id="header">
37
37
  <div id="menu">
38
-
38
+
39
39
  <a href="../_index.html">Index (S)</a> &raquo;
40
40
  <span class='title'><span class='object_link'><a href="../WorkOS.html" title="WorkOS (module)">WorkOS</a></span></span>
41
- &raquo;
41
+ &raquo;
42
42
  <span class="title">SSO</span>
43
-
43
+
44
44
  </div>
45
45
 
46
46
  <div id="search">
47
-
47
+
48
48
  <a class="full_list_link" id="class_list_link"
49
49
  href="../class_list.html">
50
50
 
@@ -54,74 +54,74 @@
54
54
  <rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
55
55
  </svg>
56
56
  </a>
57
-
57
+
58
58
  </div>
59
59
  <div class="clear"></div>
60
60
  </div>
61
61
 
62
62
  <div id="content"><h1>Module: WorkOS::SSO
63
-
64
-
65
-
63
+
64
+
65
+
66
66
  </h1>
67
67
  <div class="box_info">
68
-
69
68
 
70
-
71
-
69
+
70
+
71
+
72
72
  <dl>
73
73
  <dt>Extended by:</dt>
74
74
  <dd>T::Sig, <span class='object_link'><a href="Base.html" title="WorkOS::Base (module)">Base</a></span>, <span class='object_link'><a href="Client.html" title="WorkOS::Client (module)">Client</a></span></dd>
75
75
  </dl>
76
-
77
-
78
-
79
-
80
76
 
81
-
82
77
 
83
-
78
+
79
+
80
+
81
+
82
+
83
+
84
84
  <dl>
85
85
  <dt>Defined in:</dt>
86
86
  <dd>lib/workos/sso.rb</dd>
87
87
  </dl>
88
-
88
+
89
89
  </div>
90
90
 
91
91
  <h2>Overview</h2><div class="docstring">
92
92
  <div class="discussion">
93
-
94
- <p>The SSO module provides convenience methods for working with the WorkOS SSO platform. You&#39;ll need a valid API key, a project ID, and to have created an SSO connection on your WorkOS dashboard.</p>
93
+
94
+ <p>The SSO module provides convenience methods for working with the WorkOS SSO platform. You&#39;ll need a valid API key, a client ID, and to have created an SSO connection on your WorkOS dashboard.</p>
95
95
 
96
96
 
97
97
  </div>
98
98
  </div>
99
99
  <div class="tags">
100
-
100
+
101
101
 
102
102
  <p class="tag_title">See Also:</p>
103
103
  <ul class="see">
104
-
104
+
105
105
  <li><a href="https://docs.workos.com/sso/overview" target="_parent" title="https://docs.workos.com/sso/overview">https://docs.workos.com/sso/overview</a></li>
106
-
106
+
107
107
  </ul>
108
108
 
109
109
  </div>
110
-
110
+
111
111
  <h2>
112
112
  Constant Summary
113
113
  <small><a href="#" class="constants_summary_toggle">collapse</a></small>
114
114
  </h2>
115
115
 
116
116
  <dl class="constants">
117
-
117
+
118
118
  <dt id="PROVIDERS-constant" class="">PROVIDERS =
119
-
119
+
120
120
  </dt>
121
121
  <dd><pre class="code"><span class='const'><span class='object_link'><a href="../WorkOS.html" title="WorkOS (module)">WorkOS</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Types.html" title="WorkOS::Types (module)">Types</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Types/Provider.html" title="WorkOS::Types::Provider (class)">Provider</a></span></span><span class='period'>.</span><span class='id identifier rubyid_values'>values</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='symbol'>:serialize</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_freeze'>freeze</span></pre></dd>
122
-
122
+
123
123
  </dl>
124
-
124
+
125
125
 
126
126
 
127
127
 
@@ -129,147 +129,147 @@
129
129
 
130
130
 
131
131
  <h2>Instance Attribute Summary</h2>
132
-
132
+
133
133
  <h3 class="inherited">Attributes included from <span class='object_link'><a href="Base.html" title="WorkOS::Base (module)">Base</a></span></h3>
134
134
  <p class="inherited"><span class='object_link'><a href="Base.html#key-instance_method" title="WorkOS::Base#key (method)">#key</a></span></p>
135
135
 
136
136
 
137
-
137
+
138
138
  <h2>
139
139
  Class Method Summary
140
140
  <small><a href="#" class="summary_toggle">collapse</a></small>
141
141
  </h2>
142
142
 
143
143
  <ul class="summary">
144
-
144
+
145
145
  <li class="public ">
146
146
  <span class="summary_signature">
147
-
148
- <a href="#authorization_url-class_method" title="authorization_url (class method)">.<strong>authorization_url</strong>(project_id:, redirect_uri:, domain: nil, provider: nil, state: {}) &#x21d2; String </a>
149
-
150
147
 
151
-
148
+ <a href="#authorization_url-class_method" title="authorization_url (class method)">.<strong>authorization_url</strong>(client_id:, redirect_uri:, domain: nil, provider: nil, state: {}) &#x21d2; String </a>
149
+
150
+
151
+
152
152
  </span>
153
-
154
-
155
-
156
-
157
-
158
-
159
-
160
-
161
-
153
+
154
+
155
+
156
+
157
+
158
+
159
+
160
+
161
+
162
162
  <span class="summary_desc"><div class='inline'>
163
163
  <p>Generate an Oauth2 authorization URL where your users will authenticate using the configured SSO Identity Provider.</p>
164
164
  </div></span>
165
-
165
+
166
166
  </li>
167
167
 
168
-
168
+
169
169
  <li class="public ">
170
170
  <span class="summary_signature">
171
-
172
- <a href="#profile-class_method" title="profile (class method)">.<strong>profile</strong>(code:, project_id:) &#x21d2; WorkOS::Profile </a>
173
-
174
171
 
175
-
172
+ <a href="#profile-class_method" title="profile (class method)">.<strong>profile</strong>(code:, client_id:) &#x21d2; WorkOS::Profile </a>
173
+
174
+
175
+
176
176
  </span>
177
-
178
-
179
-
180
-
181
-
182
-
183
-
184
-
185
-
177
+
178
+
179
+
180
+
181
+
182
+
183
+
184
+
185
+
186
186
  <span class="summary_desc"><div class='inline'>
187
187
  <p>Fetch the profile details for the authenticated SSO user.</p>
188
188
  </div></span>
189
-
189
+
190
190
  </li>
191
191
 
192
-
192
+
193
193
  <li class="public ">
194
194
  <span class="summary_signature">
195
-
195
+
196
196
  <a href="#promote_draft_connection-class_method" title="promote_draft_connection (class method)">.<strong>promote_draft_connection</strong>(token:) &#x21d2; Bool </a>
197
-
198
197
 
199
-
198
+
199
+
200
200
  </span>
201
-
202
-
203
-
204
-
205
-
206
-
207
-
208
-
209
-
201
+
202
+
203
+
204
+
205
+
206
+
207
+
208
+
209
+
210
210
  <span class="summary_desc"><div class='inline'>
211
211
  <p>Promote a DraftConnection created via the WorkOS.js embed such that the Enterprise users can begin signing into your application.</p>
212
212
  </div></span>
213
-
213
+
214
214
  </li>
215
215
 
216
-
216
+
217
217
  </ul>
218
-
219
218
 
220
219
 
221
-
222
-
223
-
224
-
225
-
226
-
227
-
228
-
220
+
221
+
222
+
223
+
224
+
225
+
226
+
227
+
228
+
229
229
  <h3 class="inherited">Methods included from <span class='object_link'><a href="Client.html" title="WorkOS::Client (module)">Client</a></span></h3>
230
230
  <p class="inherited"><span class='object_link'><a href="Client.html#client-instance_method" title="WorkOS::Client#client (method)">client</a></span>, <span class='object_link'><a href="Client.html#execute_request-instance_method" title="WorkOS::Client#execute_request (method)">execute_request</a></span>, <span class='object_link'><a href="Client.html#handle_error_response-instance_method" title="WorkOS::Client#handle_error_response (method)">handle_error_response</a></span>, <span class='object_link'><a href="Client.html#post_request-instance_method" title="WorkOS::Client#post_request (method)">post_request</a></span>, <span class='object_link'><a href="Client.html#user_agent-instance_method" title="WorkOS::Client#user_agent (method)">user_agent</a></span></p>
231
231
 
232
-
233
-
234
-
235
-
236
-
237
-
238
-
239
-
240
-
241
-
232
+
233
+
234
+
235
+
236
+
237
+
238
+
239
+
240
+
241
+
242
242
 
243
243
  <div id="class_method_details" class="method_details_list">
244
244
  <h2>Class Method Details</h2>
245
245
 
246
-
246
+
247
247
  <div class="method_details first">
248
248
  <h3 class="signature first" id="authorization_url-class_method">
249
-
250
- .<strong>authorization_url</strong>(project_id:, redirect_uri:, domain: nil, provider: nil, state: {}) &#x21d2; <tt>String</tt>
251
-
252
249
 
253
-
250
+ .<strong>authorization_url</strong>(client_id:, redirect_uri:, domain: nil, provider: nil, state: {}) &#x21d2; <tt>String</tt>
251
+
252
+
253
+
254
+
254
255
 
255
-
256
256
  </h3><div class="docstring">
257
257
  <div class="discussion">
258
-
258
+
259
259
  <p>Generate an Oauth2 authorization URL where your users will authenticate using the configured SSO Identity Provider.</p>
260
260
 
261
261
 
262
262
  </div>
263
263
  </div>
264
264
  <div class="tags">
265
-
265
+
266
266
  <div class="examples">
267
267
  <p class="tag_title">Examples:</p>
268
-
269
-
268
+
269
+
270
270
  <pre class="example code"><code>WorkOS::SSO.authorization_url(
271
271
  domain: &#39;acme.com&#39;,
272
- project_id: &#39;project_01DG5TGK363GRVXP3ZS40WNGEZ&#39;,
272
+ client_id: &#39;project_01DG5TGK363GRVXP3ZS40WNGEZ&#39;,
273
273
  redirect_uri: &#39;https://workos.com/callback&#39;,
274
274
  state: {
275
275
  next_page: &#39;/docs&#39;
@@ -280,111 +280,111 @@
280
280
  &quot;&amp;client_id=project_01DG5TGK363GRVXP3ZS40WNGEZ&quot; \
281
281
  &quot;&amp;redirect_uri=https%3A%2F%2Fworkos.com%2Fcallback&amp;&quot; \
282
282
  &quot;response_type=code&amp;state=%7B%3Anext_page%3D%3E%22%2Fdocs%22%7D&quot;</code></pre>
283
-
283
+
284
284
  </div>
285
285
  <p class="tag_title">Parameters:</p>
286
286
  <ul class="param">
287
-
287
+
288
288
  <li>
289
-
289
+
290
290
  <span class='name'>domain</span>
291
-
292
-
291
+
292
+
293
293
  <span class='type'>(<tt>String</tt>)</span>
294
-
295
-
294
+
295
+
296
296
  <em class="default">(defaults to: <tt>nil</tt>)</em>
297
-
298
-
297
+
298
+
299
299
  &mdash;
300
300
  <div class='inline'>
301
301
  <p>The domain for the relevant SSO Connection configured on your WorkOS dashboard. One of provider or domain is required</p>
302
302
  </div>
303
-
303
+
304
304
  </li>
305
-
305
+
306
306
  <li>
307
-
307
+
308
308
  <span class='name'>provider</span>
309
-
310
-
309
+
310
+
311
311
  <span class='type'>(<tt>String</tt>)</span>
312
-
313
-
312
+
313
+
314
314
  <em class="default">(defaults to: <tt>nil</tt>)</em>
315
-
316
-
315
+
316
+
317
317
  &mdash;
318
318
  <div class='inline'>
319
319
  <p>A provider name for an Identity Provider configured on your WorkOS dashboard. Only &#39;Google&#39; is supported.</p>
320
320
  </div>
321
-
321
+
322
322
  </li>
323
-
323
+
324
324
  <li>
325
-
326
- <span class='name'>project_id</span>
327
-
328
-
325
+
326
+ <span class='name'>client_id</span>
327
+
328
+
329
329
  <span class='type'>(<tt>String</tt>)</span>
330
-
331
-
332
-
330
+
331
+
332
+
333
333
  &mdash;
334
334
  <div class='inline'>
335
- <p>The WorkOS project ID for the project where you&#39;ve configured your SSO connection.</p>
335
+ <p>The WorkOS client ID for the environment where you&#39;ve configured your SSO connection.</p>
336
336
  </div>
337
-
337
+
338
338
  </li>
339
-
339
+
340
340
  <li>
341
-
341
+
342
342
  <span class='name'>redirect_uri</span>
343
-
344
-
343
+
344
+
345
345
  <span class='type'>(<tt>String</tt>)</span>
346
-
347
-
348
-
346
+
347
+
348
+
349
349
  &mdash;
350
350
  <div class='inline'>
351
351
  <p>The URI where users are directed after completing the authentication step. Must match a configured redirect URI on your WorkOS dashboard.</p>
352
352
  </div>
353
-
353
+
354
354
  </li>
355
-
355
+
356
356
  <li>
357
-
357
+
358
358
  <span class='name'>state</span>
359
-
360
-
359
+
360
+
361
361
  <span class='type'>(<tt>Hash</tt>)</span>
362
-
363
-
362
+
363
+
364
364
  <em class="default">(defaults to: <tt>{}</tt>)</em>
365
-
366
-
365
+
366
+
367
367
  &mdash;
368
368
  <div class='inline'>
369
369
  <p>An aribtrary state object that is preserved and available to the client in the response.</p>
370
370
  </div>
371
-
371
+
372
372
  </li>
373
-
373
+
374
374
  </ul>
375
375
 
376
376
  <p class="tag_title">Returns:</p>
377
377
  <ul class="return">
378
-
378
+
379
379
  <li>
380
-
381
-
380
+
381
+
382
382
  <span class='type'>(<tt>String</tt>)</span>
383
-
384
-
385
-
383
+
384
+
385
+
386
386
  </li>
387
-
387
+
388
388
  </ul>
389
389
 
390
390
  </div><table class="source_code">
@@ -414,12 +414,12 @@
414
414
  <pre class="code"><span class="info file"># File 'lib/workos/sso.rb', line 62</span>
415
415
 
416
416
  <span class='kw'>def</span> <span class='id identifier rubyid_authorization_url'>authorization_url</span><span class='lparen'>(</span>
417
- <span class='label'>project_id:</span><span class='comma'>,</span> <span class='label'>redirect_uri:</span><span class='comma'>,</span> <span class='label'>domain:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='label'>provider:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='label'>state:</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
417
+ <span class='label'>client_id:</span><span class='comma'>,</span> <span class='label'>redirect_uri:</span><span class='comma'>,</span> <span class='label'>domain:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='label'>provider:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='label'>state:</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
418
418
  <span class='rparen'>)</span>
419
419
  <span class='id identifier rubyid_validate_domain_and_provider'>validate_domain_and_provider</span><span class='lparen'>(</span><span class='label'>provider:</span> <span class='id identifier rubyid_provider'>provider</span><span class='comma'>,</span> <span class='label'>domain:</span> <span class='id identifier rubyid_domain'>domain</span><span class='rparen'>)</span>
420
420
 
421
421
  <span class='id identifier rubyid_query'>query</span> <span class='op'>=</span> <span class='const'>URI</span><span class='period'>.</span><span class='id identifier rubyid_encode_www_form'>encode_www_form</span><span class='lparen'>(</span><span class='lbrace'>{</span>
422
- <span class='label'>client_id:</span> <span class='id identifier rubyid_project_id'>project_id</span><span class='comma'>,</span>
422
+ <span class='label'>client_id:</span> <span class='id identifier rubyid_project_id'>client_id</span><span class='comma'>,</span>
423
423
  <span class='label'>redirect_uri:</span> <span class='id identifier rubyid_redirect_uri'>redirect_uri</span><span class='comma'>,</span>
424
424
  <span class='label'>response_type:</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>code</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span>
425
425
  <span class='label'>state:</span> <span class='id identifier rubyid_state'>state</span><span class='comma'>,</span>
@@ -433,33 +433,33 @@
433
433
  </tr>
434
434
  </table>
435
435
  </div>
436
-
436
+
437
437
  <div class="method_details ">
438
438
  <h3 class="signature " id="profile-class_method">
439
-
440
- .<strong>profile</strong>(code:, project_id:) &#x21d2; <tt><span class='object_link'><a href="Profile.html" title="WorkOS::Profile (class)">WorkOS::Profile</a></span></tt>
441
-
442
439
 
443
-
440
+ .<strong>profile</strong>(code:, client_id:) &#x21d2; <tt><span class='object_link'><a href="Profile.html" title="WorkOS::Profile (class)">WorkOS::Profile</a></span></tt>
441
+
442
+
443
+
444
+
444
445
 
445
-
446
446
  </h3><div class="docstring">
447
447
  <div class="discussion">
448
-
448
+
449
449
  <p>Fetch the profile details for the authenticated SSO user.</p>
450
450
 
451
451
 
452
452
  </div>
453
453
  </div>
454
454
  <div class="tags">
455
-
455
+
456
456
  <div class="examples">
457
457
  <p class="tag_title">Examples:</p>
458
-
459
-
458
+
459
+
460
460
  <pre class="example code"><code>WorkOS::SSO.profile(
461
461
  code: &#39;acme.com&#39;,
462
- project_id: &#39;project_01DG5TGK363GRVXP3ZS40WNGEZ&#39;
462
+ client_id: &#39;project_01DG5TGK363GRVXP3ZS40WNGEZ&#39;
463
463
  )
464
464
  =&gt; #&lt;WorkOS::Profile:0x00007fb6e4193d20
465
465
  @id=&quot;prof_01DRA1XNSJDZ19A31F183ECQW5&quot;,
@@ -470,57 +470,57 @@
470
470
  @idp_id=&quot;00u1klkowm8EGah2H357&quot;,
471
471
  @access_token=&quot;01DVX6QBS3EG6FHY2ESAA5Q65X&quot;
472
472
  &gt;</code></pre>
473
-
473
+
474
474
  </div>
475
475
  <p class="tag_title">Parameters:</p>
476
476
  <ul class="param">
477
-
477
+
478
478
  <li>
479
-
479
+
480
480
  <span class='name'>code</span>
481
-
482
-
481
+
482
+
483
483
  <span class='type'>(<tt>String</tt>)</span>
484
-
485
-
486
-
484
+
485
+
486
+
487
487
  &mdash;
488
488
  <div class='inline'>
489
489
  <p>The authorization code provided in the callback URL</p>
490
490
  </div>
491
-
491
+
492
492
  </li>
493
-
493
+
494
494
  <li>
495
-
496
- <span class='name'>project_id</span>
497
-
498
-
495
+
496
+ <span class='name'>client_id</span>
497
+
498
+
499
499
  <span class='type'>(<tt>String</tt>)</span>
500
-
501
-
502
-
500
+
501
+
502
+
503
503
  &mdash;
504
504
  <div class='inline'>
505
- <p>The WorkOS project ID for the project where you&#39;ve configured your SSO connection</p>
505
+ <p>The WorkOS client ID for the environment where you&#39;ve configured your SSO connection</p>
506
506
  </div>
507
-
507
+
508
508
  </li>
509
-
509
+
510
510
  </ul>
511
511
 
512
512
  <p class="tag_title">Returns:</p>
513
513
  <ul class="return">
514
-
514
+
515
515
  <li>
516
-
517
-
516
+
517
+
518
518
  <span class='type'>(<tt><span class='object_link'><a href="Profile.html" title="WorkOS::Profile (class)">WorkOS::Profile</a></span></tt>)</span>
519
-
520
-
521
-
519
+
520
+
521
+
522
522
  </li>
523
-
523
+
524
524
  </ul>
525
525
 
526
526
  </div><table class="source_code">
@@ -546,9 +546,9 @@
546
546
  <td>
547
547
  <pre class="code"><span class="info file"># File 'lib/workos/sso.rb', line 108</span>
548
548
 
549
- <span class='kw'>def</span> <span class='id identifier rubyid_profile'>profile</span><span class='lparen'>(</span><span class='label'>code:</span><span class='comma'>,</span> <span class='label'>project_id:</span><span class='rparen'>)</span>
549
+ <span class='kw'>def</span> <span class='id identifier rubyid_profile'>profile</span><span class='lparen'>(</span><span class='label'>code:</span><span class='comma'>,</span> <span class='label'>client_id:</span><span class='rparen'>)</span>
550
550
  <span class='id identifier rubyid_body'>body</span> <span class='op'>=</span> <span class='lbrace'>{</span>
551
- <span class='label'>client_id:</span> <span class='id identifier rubyid_project_id'>project_id</span><span class='comma'>,</span>
551
+ <span class='label'>client_id:</span> <span class='id identifier rubyid_project_id'>client_id</span><span class='comma'>,</span>
552
552
  <span class='label'>client_secret:</span> <span class='const'><span class='object_link'><a href="../WorkOS.html" title="WorkOS (module)">WorkOS</a></span></span><span class='period'>.</span><span class='id identifier rubyid_key!'><span class='object_link'><a href="../WorkOS.html#key!-class_method" title="WorkOS.key! (method)">key!</a></span></span><span class='comma'>,</span>
553
553
  <span class='label'>grant_type:</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>authorization_code</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span>
554
554
  <span class='label'>code:</span> <span class='id identifier rubyid_code'>code</span><span class='comma'>,</span>
@@ -563,19 +563,19 @@
563
563
  </tr>
564
564
  </table>
565
565
  </div>
566
-
566
+
567
567
  <div class="method_details ">
568
568
  <h3 class="signature " id="promote_draft_connection-class_method">
569
-
570
- .<strong>promote_draft_connection</strong>(token:) &#x21d2; <tt>Bool</tt>
571
-
572
569
 
573
-
570
+ .<strong>promote_draft_connection</strong>(token:) &#x21d2; <tt>Bool</tt>
571
+
572
+
573
+
574
+
574
575
 
575
-
576
576
  </h3><div class="docstring">
577
577
  <div class="discussion">
578
-
578
+
579
579
  <p>Promote a DraftConnection created via the WorkOS.js embed such that the Enterprise users can begin signing into your application.</p>
580
580
 
581
581
  <p>you by the WorkOS.js embed</p>
@@ -584,63 +584,63 @@
584
584
  </div>
585
585
  </div>
586
586
  <div class="tags">
587
-
587
+
588
588
  <div class="examples">
589
589
  <p class="tag_title">Examples:</p>
590
-
591
-
590
+
591
+
592
592
  <pre class="example code"><code>WorkOS::SSO.promote_draft_connection(
593
593
  token: &#39;draft_conn_429u59js&#39;,
594
594
  )
595
595
  =&gt; true</code></pre>
596
-
596
+
597
597
  </div>
598
598
  <p class="tag_title">Parameters:</p>
599
599
  <ul class="param">
600
-
600
+
601
601
  <li>
602
-
602
+
603
603
  <span class='name'>token</span>
604
-
605
-
604
+
605
+
606
606
  <span class='type'>(<tt>String</tt>)</span>
607
-
608
-
609
-
607
+
608
+
609
+
610
610
  &mdash;
611
611
  <div class='inline'>
612
612
  <p>The draft connection token that&#39;s been provided to</p>
613
613
  </div>
614
-
614
+
615
615
  </li>
616
-
616
+
617
617
  </ul>
618
618
 
619
619
  <p class="tag_title">Returns:</p>
620
620
  <ul class="return">
621
-
621
+
622
622
  <li>
623
-
624
-
623
+
624
+
625
625
  <span class='type'>(<tt>Bool</tt>)</span>
626
-
627
-
628
-
626
+
627
+
628
+
629
629
  &mdash;
630
630
  <div class='inline'><ul><li>
631
631
  <p>returns `true` if successful, `false` otherwise.</p>
632
632
  </li></ul>
633
633
  </div>
634
-
634
+
635
635
  </li>
636
-
636
+
637
637
  </ul>
638
638
 
639
639
  <p class="tag_title">See Also:</p>
640
640
  <ul class="see">
641
-
641
+
642
642
  <li><a href="https://github.com/workos-inc/ruby-idp-link-example" target="_parent" title="https://github.com/workos-inc/ruby-idp-link-example">https://github.com/workos-inc/ruby-idp-link-example</a></li>
643
-
643
+
644
644
  </ul>
645
645
 
646
646
  </div><table class="source_code">
@@ -675,7 +675,7 @@
675
675
  </tr>
676
676
  </table>
677
677
  </div>
678
-
678
+
679
679
  </div>
680
680
 
681
681
  </div>
@@ -688,4 +688,4 @@
688
688
 
689
689
  </div>
690
690
  </body>
691
- </html>
691
+ </html>