workos 2.17.0 → 3.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (109) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +2 -0
  3. data/Gemfile.lock +5 -14
  4. data/lib/workos/authentication_factor_and_challenge.rb +31 -0
  5. data/lib/workos/authentication_response.rb +27 -0
  6. data/lib/workos/invitation.rb +68 -0
  7. data/lib/workos/organization_membership.rb +50 -0
  8. data/lib/workos/types/invitation_struct.rb +20 -0
  9. data/lib/workos/types/magic_auth_challenge_struct.rb +12 -0
  10. data/lib/workos/types/organization_membership_struct.rb +15 -0
  11. data/lib/workos/types/user_struct.rb +18 -0
  12. data/lib/workos/types.rb +9 -5
  13. data/lib/workos/user.rb +60 -0
  14. data/lib/workos/user_and_token.rb +29 -0
  15. data/lib/workos/user_management.rb +1008 -0
  16. data/lib/workos/user_response.rb +25 -0
  17. data/lib/workos/version.rb +1 -1
  18. data/lib/workos.rb +17 -12
  19. data/spec/lib/workos/user_management_spec.rb +1092 -0
  20. data/spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_code/invalid.yml +84 -0
  21. data/spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_code/valid.yml +82 -0
  22. data/spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_email_verification/invalid.yml +83 -0
  23. data/spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_email_verification/valid.yml +81 -0
  24. data/spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_magic_auth/invalid.yml +82 -0
  25. data/spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_magic_auth/valid.yml +82 -0
  26. data/spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_organization_selection/invalid.yml +81 -0
  27. data/spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_organization_selection/valid.yml +82 -0
  28. data/spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_password/invalid.yml +82 -0
  29. data/spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_password/valid.yml +82 -0
  30. data/spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_totp/invalid.yml +83 -0
  31. data/spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_totp/valid.yml +81 -0
  32. data/spec/support/fixtures/vcr_cassettes/user_management/confirm_password_reset/invalid.yml +82 -0
  33. data/spec/support/fixtures/vcr_cassettes/user_management/confirm_password_reset/valid.yml +82 -0
  34. data/spec/support/fixtures/vcr_cassettes/user_management/create_organization_membership/invalid.yml +83 -0
  35. data/spec/support/fixtures/vcr_cassettes/user_management/create_organization_membership/valid.yml +82 -0
  36. data/spec/support/fixtures/vcr_cassettes/user_management/create_user_invalid.yml +83 -0
  37. data/spec/support/fixtures/vcr_cassettes/user_management/create_user_valid.yml +82 -0
  38. data/spec/support/fixtures/vcr_cassettes/user_management/delete_organization_membership/invalid.yml +82 -0
  39. data/spec/support/fixtures/vcr_cassettes/user_management/delete_organization_membership/valid.yml +78 -0
  40. data/spec/support/fixtures/vcr_cassettes/user_management/delete_user/invalid.yml +82 -0
  41. data/spec/support/fixtures/vcr_cassettes/user_management/delete_user/valid.yml +78 -0
  42. data/spec/support/fixtures/vcr_cassettes/user_management/enroll_auth_factor/invalid.yml +82 -0
  43. data/spec/support/fixtures/vcr_cassettes/user_management/enroll_auth_factor/valid.yml +82 -0
  44. data/spec/support/fixtures/vcr_cassettes/user_management/get_invitation/invalid.yml +82 -0
  45. data/spec/support/fixtures/vcr_cassettes/user_management/get_invitation/valid.yml +82 -0
  46. data/spec/support/fixtures/vcr_cassettes/user_management/get_organization_membership.yml +82 -0
  47. data/spec/support/fixtures/vcr_cassettes/user_management/get_user.yml +82 -0
  48. data/spec/support/fixtures/vcr_cassettes/user_management/list_auth_factors/invalid.yml +82 -0
  49. data/spec/support/fixtures/vcr_cassettes/user_management/list_auth_factors/valid.yml +82 -0
  50. data/spec/support/fixtures/vcr_cassettes/user_management/list_invitations/with_after.yml +83 -0
  51. data/spec/support/fixtures/vcr_cassettes/user_management/list_invitations/with_before.yml +83 -0
  52. data/spec/support/fixtures/vcr_cassettes/user_management/list_invitations/with_limit.yml +83 -0
  53. data/spec/support/fixtures/vcr_cassettes/user_management/list_invitations/with_no_options.yml +83 -0
  54. data/spec/support/fixtures/vcr_cassettes/user_management/list_invitations/with_organization_id.yml +83 -0
  55. data/spec/support/fixtures/vcr_cassettes/user_management/list_organization_memberships/no_options.yml +82 -0
  56. data/spec/support/fixtures/vcr_cassettes/user_management/list_organization_memberships/with_options.yml +82 -0
  57. data/spec/support/fixtures/vcr_cassettes/user_management/list_users/no_options.yml +82 -0
  58. data/spec/support/fixtures/vcr_cassettes/user_management/list_users/with_options.yml +82 -0
  59. data/spec/support/fixtures/vcr_cassettes/user_management/reset_password/invalid.yml +82 -0
  60. data/spec/support/fixtures/vcr_cassettes/user_management/reset_password/valid.yml +82 -0
  61. data/spec/support/fixtures/vcr_cassettes/user_management/revoke_invitation/invalid.yml +82 -0
  62. data/spec/support/fixtures/vcr_cassettes/user_management/revoke_invitation/valid.yml +82 -0
  63. data/spec/support/fixtures/vcr_cassettes/user_management/send_invitation/invalid.yml +82 -0
  64. data/spec/support/fixtures/vcr_cassettes/user_management/send_invitation/valid.yml +82 -0
  65. data/spec/support/fixtures/vcr_cassettes/user_management/send_magic_auth_code/valid.yml +82 -0
  66. data/spec/support/fixtures/vcr_cassettes/user_management/send_password_reset_email/invalid.yml +83 -0
  67. data/spec/support/fixtures/vcr_cassettes/user_management/send_password_reset_email/valid.yml +82 -0
  68. data/spec/support/fixtures/vcr_cassettes/user_management/send_verification_email/invalid.yml +82 -0
  69. data/spec/support/fixtures/vcr_cassettes/user_management/send_verification_email/valid.yml +82 -0
  70. data/spec/support/fixtures/vcr_cassettes/user_management/update_user/invalid.yml +82 -0
  71. data/spec/support/fixtures/vcr_cassettes/user_management/update_user/valid.yml +82 -0
  72. data/spec/support/fixtures/vcr_cassettes/user_management/update_user_password/invalid.yml +82 -0
  73. data/spec/support/fixtures/vcr_cassettes/user_management/update_user_password/valid.yml +82 -0
  74. data/spec/support/fixtures/vcr_cassettes/user_management/verify_email/invalid_code.yml +83 -0
  75. data/spec/support/fixtures/vcr_cassettes/user_management/verify_email/invalid_magic_auth_challenge.yml +82 -0
  76. data/spec/support/fixtures/vcr_cassettes/user_management/verify_email/valid.yml +82 -0
  77. data/workos.gemspec +0 -1
  78. metadata +131 -49
  79. data/bin/docs +0 -5
  80. data/docs/WorkOS/APIError.html +0 -160
  81. data/docs/WorkOS/AuditLog.html +0 -235
  82. data/docs/WorkOS/AuditTrail.html +0 -235
  83. data/docs/WorkOS/AuthenticationError.html +0 -160
  84. data/docs/WorkOS/Base.html +0 -287
  85. data/docs/WorkOS/Client.html +0 -504
  86. data/docs/WorkOS/InvalidRequestError.html +0 -160
  87. data/docs/WorkOS/Profile.html +0 -788
  88. data/docs/WorkOS/RequestError.html +0 -135
  89. data/docs/WorkOS/SSO.html +0 -691
  90. data/docs/WorkOS/Types/ProfileStruct.html +0 -135
  91. data/docs/WorkOS/Types/Provider.html +0 -135
  92. data/docs/WorkOS/Types.html +0 -128
  93. data/docs/WorkOS/WorkOSError.html +0 -447
  94. data/docs/WorkOS.html +0 -324
  95. data/docs/class_list.html +0 -51
  96. data/docs/css/common.css +0 -1
  97. data/docs/css/full_list.css +0 -58
  98. data/docs/css/style.css +0 -496
  99. data/docs/file.README.html +0 -252
  100. data/docs/file_list.html +0 -56
  101. data/docs/frames.html +0 -17
  102. data/docs/index.html +0 -250
  103. data/docs/js/app.js +0 -314
  104. data/docs/js/full_list.js +0 -216
  105. data/docs/js/jquery.js +0 -4
  106. data/docs/method_list.html +0 -267
  107. data/docs/top-level-namespace.html +0 -110
  108. data/lib/workos/audit_trail.rb +0 -111
  109. data/spec/lib/workos/audit_trail_spec.rb +0 -146
data/docs/WorkOS/SSO.html DELETED
@@ -1,691 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8">
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
- <title>
7
- Module: WorkOS::SSO
8
-
9
- &mdash; Documentation by YARD 0.9.22
10
-
11
- </title>
12
-
13
- <link rel="stylesheet" href="../css/style.css" type="text/css" />
14
-
15
- <link rel="stylesheet" href="../css/common.css" type="text/css" />
16
-
17
- <script type="text/javascript">
18
- pathId = "WorkOS::SSO";
19
- relpath = '../';
20
- </script>
21
-
22
-
23
- <script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
24
-
25
- <script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
26
-
27
-
28
- </head>
29
- <body>
30
- <div class="nav_wrap">
31
- <iframe id="nav" src="../class_list.html?1"></iframe>
32
- <div id="resizer"></div>
33
- </div>
34
-
35
- <div id="main" tabindex="-1">
36
- <div id="header">
37
- <div id="menu">
38
-
39
- <a href="../_index.html">Index (S)</a> &raquo;
40
- <span class='title'><span class='object_link'><a href="../WorkOS.html" title="WorkOS (module)">WorkOS</a></span></span>
41
- &raquo;
42
- <span class="title">SSO</span>
43
-
44
- </div>
45
-
46
- <div id="search">
47
-
48
- <a class="full_list_link" id="class_list_link"
49
- href="../class_list.html">
50
-
51
- <svg width="24" height="24">
52
- <rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
53
- <rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
54
- <rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
55
- </svg>
56
- </a>
57
-
58
- </div>
59
- <div class="clear"></div>
60
- </div>
61
-
62
- <div id="content"><h1>Module: WorkOS::SSO
63
-
64
-
65
-
66
- </h1>
67
- <div class="box_info">
68
-
69
-
70
-
71
-
72
- <dl>
73
- <dt>Extended by:</dt>
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
- </dl>
76
-
77
-
78
-
79
-
80
-
81
-
82
-
83
-
84
- <dl>
85
- <dt>Defined in:</dt>
86
- <dd>lib/workos/sso.rb</dd>
87
- </dl>
88
-
89
- </div>
90
-
91
- <h2>Overview</h2><div class="docstring">
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 client ID, and to have created an SSO connection on your WorkOS dashboard.</p>
95
-
96
-
97
- </div>
98
- </div>
99
- <div class="tags">
100
-
101
-
102
- <p class="tag_title">See Also:</p>
103
- <ul class="see">
104
-
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
-
107
- </ul>
108
-
109
- </div>
110
-
111
- <h2>
112
- Constant Summary
113
- <small><a href="#" class="constants_summary_toggle">collapse</a></small>
114
- </h2>
115
-
116
- <dl class="constants">
117
-
118
- <dt id="PROVIDERS-constant" class="">PROVIDERS =
119
-
120
- </dt>
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
-
123
- </dl>
124
-
125
-
126
-
127
-
128
-
129
-
130
-
131
- <h2>Instance Attribute Summary</h2>
132
-
133
- <h3 class="inherited">Attributes included from <span class='object_link'><a href="Base.html" title="WorkOS::Base (module)">Base</a></span></h3>
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
-
136
-
137
-
138
- <h2>
139
- Class Method Summary
140
- <small><a href="#" class="summary_toggle">collapse</a></small>
141
- </h2>
142
-
143
- <ul class="summary">
144
-
145
- <li class="public ">
146
- <span class="summary_signature">
147
-
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
- </span>
153
-
154
-
155
-
156
-
157
-
158
-
159
-
160
-
161
-
162
- <span class="summary_desc"><div class='inline'>
163
- <p>Generate an Oauth2 authorization URL where your users will authenticate using the configured SSO Identity Provider.</p>
164
- </div></span>
165
-
166
- </li>
167
-
168
-
169
- <li class="public ">
170
- <span class="summary_signature">
171
-
172
- <a href="#profile-class_method" title="profile (class method)">.<strong>profile</strong>(code:, client_id:) &#x21d2; WorkOS::Profile </a>
173
-
174
-
175
-
176
- </span>
177
-
178
-
179
-
180
-
181
-
182
-
183
-
184
-
185
-
186
- <span class="summary_desc"><div class='inline'>
187
- <p>Fetch the profile details for the authenticated SSO user.</p>
188
- </div></span>
189
-
190
- </li>
191
-
192
-
193
- <li class="public ">
194
- <span class="summary_signature">
195
-
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
-
199
-
200
- </span>
201
-
202
-
203
-
204
-
205
-
206
-
207
-
208
-
209
-
210
- <span class="summary_desc"><div class='inline'>
211
- <p>Promote a DraftConnection created via the WorkOS.js embed such that the Enterprise users can begin signing into your application.</p>
212
- </div></span>
213
-
214
- </li>
215
-
216
-
217
- </ul>
218
-
219
-
220
-
221
-
222
-
223
-
224
-
225
-
226
-
227
-
228
-
229
- <h3 class="inherited">Methods included from <span class='object_link'><a href="Client.html" title="WorkOS::Client (module)">Client</a></span></h3>
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
-
232
-
233
-
234
-
235
-
236
-
237
-
238
-
239
-
240
-
241
-
242
-
243
- <div id="class_method_details" class="method_details_list">
244
- <h2>Class Method Details</h2>
245
-
246
-
247
- <div class="method_details first">
248
- <h3 class="signature first" id="authorization_url-class_method">
249
-
250
- .<strong>authorization_url</strong>(client_id:, redirect_uri:, domain: nil, provider: nil, state: {}) &#x21d2; <tt>String</tt>
251
-
252
-
253
-
254
-
255
-
256
- </h3><div class="docstring">
257
- <div class="discussion">
258
-
259
- <p>Generate an Oauth2 authorization URL where your users will authenticate using the configured SSO Identity Provider.</p>
260
-
261
-
262
- </div>
263
- </div>
264
- <div class="tags">
265
-
266
- <div class="examples">
267
- <p class="tag_title">Examples:</p>
268
-
269
-
270
- <pre class="example code"><code>WorkOS::SSO.authorization_url(
271
- domain: &#39;acme.com&#39;,
272
- client_id: &#39;project_01DG5TGK363GRVXP3ZS40WNGEZ&#39;,
273
- redirect_uri: &#39;https://workos.com/callback&#39;,
274
- state: {
275
- next_page: &#39;/docs&#39;
276
- }
277
- )
278
-
279
- =&gt; &quot;https://api.workos.com/sso/authorize?domain=acme.com&quot; \
280
- &quot;&amp;client_id=project_01DG5TGK363GRVXP3ZS40WNGEZ&quot; \
281
- &quot;&amp;redirect_uri=https%3A%2F%2Fworkos.com%2Fcallback&amp;&quot; \
282
- &quot;response_type=code&amp;state=%7B%3Anext_page%3D%3E%22%2Fdocs%22%7D&quot;</code></pre>
283
-
284
- </div>
285
- <p class="tag_title">Parameters:</p>
286
- <ul class="param">
287
-
288
- <li>
289
-
290
- <span class='name'>domain</span>
291
-
292
-
293
- <span class='type'>(<tt>String</tt>)</span>
294
-
295
-
296
- <em class="default">(defaults to: <tt>nil</tt>)</em>
297
-
298
-
299
- &mdash;
300
- <div class='inline'>
301
- <p>The domain for the relevant SSO Connection configured on your WorkOS dashboard. One of provider or domain is required</p>
302
- </div>
303
-
304
- </li>
305
-
306
- <li>
307
-
308
- <span class='name'>provider</span>
309
-
310
-
311
- <span class='type'>(<tt>String</tt>)</span>
312
-
313
-
314
- <em class="default">(defaults to: <tt>nil</tt>)</em>
315
-
316
-
317
- &mdash;
318
- <div class='inline'>
319
- <p>A provider name for an Identity Provider configured on your WorkOS dashboard. Only &#39;Google&#39; is supported.</p>
320
- </div>
321
-
322
- </li>
323
-
324
- <li>
325
-
326
- <span class='name'>client_id</span>
327
-
328
-
329
- <span class='type'>(<tt>String</tt>)</span>
330
-
331
-
332
-
333
- &mdash;
334
- <div class='inline'>
335
- <p>The WorkOS client ID for the environment where you&#39;ve configured your SSO connection.</p>
336
- </div>
337
-
338
- </li>
339
-
340
- <li>
341
-
342
- <span class='name'>redirect_uri</span>
343
-
344
-
345
- <span class='type'>(<tt>String</tt>)</span>
346
-
347
-
348
-
349
- &mdash;
350
- <div class='inline'>
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
- </div>
353
-
354
- </li>
355
-
356
- <li>
357
-
358
- <span class='name'>state</span>
359
-
360
-
361
- <span class='type'>(<tt>Hash</tt>)</span>
362
-
363
-
364
- <em class="default">(defaults to: <tt>{}</tt>)</em>
365
-
366
-
367
- &mdash;
368
- <div class='inline'>
369
- <p>An aribtrary state object that is preserved and available to the client in the response.</p>
370
- </div>
371
-
372
- </li>
373
-
374
- </ul>
375
-
376
- <p class="tag_title">Returns:</p>
377
- <ul class="return">
378
-
379
- <li>
380
-
381
-
382
- <span class='type'>(<tt>String</tt>)</span>
383
-
384
-
385
-
386
- </li>
387
-
388
- </ul>
389
-
390
- </div><table class="source_code">
391
- <tr>
392
- <td>
393
- <pre class="lines">
394
-
395
-
396
- 62
397
- 63
398
- 64
399
- 65
400
- 66
401
- 67
402
- 68
403
- 69
404
- 70
405
- 71
406
- 72
407
- 73
408
- 74
409
- 75
410
- 76
411
- 77</pre>
412
- </td>
413
- <td>
414
- <pre class="code"><span class="info file"># File 'lib/workos/sso.rb', line 62</span>
415
-
416
- <span class='kw'>def</span> <span class='id identifier rubyid_authorization_url'>authorization_url</span><span class='lparen'>(</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
- <span class='rparen'>)</span>
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
-
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'>client_id</span><span class='comma'>,</span>
423
- <span class='label'>redirect_uri:</span> <span class='id identifier rubyid_redirect_uri'>redirect_uri</span><span class='comma'>,</span>
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
- <span class='label'>state:</span> <span class='id identifier rubyid_state'>state</span><span class='comma'>,</span>
426
- <span class='label'>domain:</span> <span class='id identifier rubyid_domain'>domain</span><span class='comma'>,</span>
427
- <span class='label'>provider:</span> <span class='id identifier rubyid_provider'>provider</span><span class='comma'>,</span>
428
- <span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_compact'>compact</span><span class='rparen'>)</span>
429
-
430
- <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>https://</span><span class='embexpr_beg'>#{</span><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="../WorkOS.html#API_HOSTNAME-constant" title="WorkOS::API_HOSTNAME (constant)">API_HOSTNAME</a></span></span><span class='embexpr_end'>}</span><span class='tstring_content'>/sso/authorize?</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_query'>query</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span>
431
- <span class='kw'>end</span></pre>
432
- </td>
433
- </tr>
434
- </table>
435
- </div>
436
-
437
- <div class="method_details ">
438
- <h3 class="signature " id="profile-class_method">
439
-
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
-
445
-
446
- </h3><div class="docstring">
447
- <div class="discussion">
448
-
449
- <p>Fetch the profile details for the authenticated SSO user.</p>
450
-
451
-
452
- </div>
453
- </div>
454
- <div class="tags">
455
-
456
- <div class="examples">
457
- <p class="tag_title">Examples:</p>
458
-
459
-
460
- <pre class="example code"><code>WorkOS::SSO.profile(
461
- code: &#39;acme.com&#39;,
462
- client_id: &#39;project_01DG5TGK363GRVXP3ZS40WNGEZ&#39;
463
- )
464
- =&gt; #&lt;WorkOS::Profile:0x00007fb6e4193d20
465
- @id=&quot;prof_01DRA1XNSJDZ19A31F183ECQW5&quot;,
466
- @email=&quot;demo@workos-okta.com&quot;,
467
- @first_name=&quot;WorkOS&quot;,
468
- @connection_type=&quot;OktaSAML&quot;,
469
- @last_name=&quot;Demo&quot;,
470
- @idp_id=&quot;00u1klkowm8EGah2H357&quot;,
471
- @access_token=&quot;01DVX6QBS3EG6FHY2ESAA5Q65X&quot;
472
- &gt;</code></pre>
473
-
474
- </div>
475
- <p class="tag_title">Parameters:</p>
476
- <ul class="param">
477
-
478
- <li>
479
-
480
- <span class='name'>code</span>
481
-
482
-
483
- <span class='type'>(<tt>String</tt>)</span>
484
-
485
-
486
-
487
- &mdash;
488
- <div class='inline'>
489
- <p>The authorization code provided in the callback URL</p>
490
- </div>
491
-
492
- </li>
493
-
494
- <li>
495
-
496
- <span class='name'>client_id</span>
497
-
498
-
499
- <span class='type'>(<tt>String</tt>)</span>
500
-
501
-
502
-
503
- &mdash;
504
- <div class='inline'>
505
- <p>The WorkOS client ID for the environment where you&#39;ve configured your SSO connection</p>
506
- </div>
507
-
508
- </li>
509
-
510
- </ul>
511
-
512
- <p class="tag_title">Returns:</p>
513
- <ul class="return">
514
-
515
- <li>
516
-
517
-
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
-
522
- </li>
523
-
524
- </ul>
525
-
526
- </div><table class="source_code">
527
- <tr>
528
- <td>
529
- <pre class="lines">
530
-
531
-
532
- 108
533
- 109
534
- 110
535
- 111
536
- 112
537
- 113
538
- 114
539
- 115
540
- 116
541
- 117
542
- 118
543
- 119
544
- 120</pre>
545
- </td>
546
- <td>
547
- <pre class="code"><span class="info file"># File 'lib/workos/sso.rb', line 108</span>
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'>client_id:</span><span class='rparen'>)</span>
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'>client_id</span><span class='comma'>,</span>
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
- <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
- <span class='label'>code:</span> <span class='id identifier rubyid_code'>code</span><span class='comma'>,</span>
555
- <span class='rbrace'>}</span>
556
-
557
- <span class='id identifier rubyid_response'>response</span> <span class='op'>=</span> <span class='id identifier rubyid_client'>client</span><span class='period'>.</span><span class='id identifier rubyid_request'>request</span><span class='lparen'>(</span><span class='id identifier rubyid_post_request'>post_request</span><span class='lparen'>(</span><span class='label'>path:</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>/sso/token</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span> <span class='label'>body:</span> <span class='id identifier rubyid_body'>body</span><span class='rparen'>)</span><span class='rparen'>)</span>
558
- <span class='id identifier rubyid_check_and_raise_profile_error'>check_and_raise_profile_error</span><span class='lparen'>(</span><span class='label'>response:</span> <span class='id identifier rubyid_response'>response</span><span class='rparen'>)</span>
559
-
560
- <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="Profile.html" title="WorkOS::Profile (class)">Profile</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="Profile.html#initialize-instance_method" title="WorkOS::Profile#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_response'>response</span><span class='period'>.</span><span class='id identifier rubyid_body'>body</span><span class='rparen'>)</span>
561
- <span class='kw'>end</span></pre>
562
- </td>
563
- </tr>
564
- </table>
565
- </div>
566
-
567
- <div class="method_details ">
568
- <h3 class="signature " id="promote_draft_connection-class_method">
569
-
570
- .<strong>promote_draft_connection</strong>(token:) &#x21d2; <tt>Bool</tt>
571
-
572
-
573
-
574
-
575
-
576
- </h3><div class="docstring">
577
- <div class="discussion">
578
-
579
- <p>Promote a DraftConnection created via the WorkOS.js embed such that the Enterprise users can begin signing into your application.</p>
580
-
581
- <p>you by the WorkOS.js embed</p>
582
-
583
-
584
- </div>
585
- </div>
586
- <div class="tags">
587
-
588
- <div class="examples">
589
- <p class="tag_title">Examples:</p>
590
-
591
-
592
- <pre class="example code"><code>WorkOS::SSO.promote_draft_connection(
593
- token: &#39;draft_conn_429u59js&#39;,
594
- )
595
- =&gt; true</code></pre>
596
-
597
- </div>
598
- <p class="tag_title">Parameters:</p>
599
- <ul class="param">
600
-
601
- <li>
602
-
603
- <span class='name'>token</span>
604
-
605
-
606
- <span class='type'>(<tt>String</tt>)</span>
607
-
608
-
609
-
610
- &mdash;
611
- <div class='inline'>
612
- <p>The draft connection token that&#39;s been provided to</p>
613
- </div>
614
-
615
- </li>
616
-
617
- </ul>
618
-
619
- <p class="tag_title">Returns:</p>
620
- <ul class="return">
621
-
622
- <li>
623
-
624
-
625
- <span class='type'>(<tt>Bool</tt>)</span>
626
-
627
-
628
-
629
- &mdash;
630
- <div class='inline'><ul><li>
631
- <p>returns `true` if successful, `false` otherwise.</p>
632
- </li></ul>
633
- </div>
634
-
635
- </li>
636
-
637
- </ul>
638
-
639
- <p class="tag_title">See Also:</p>
640
- <ul class="see">
641
-
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
-
644
- </ul>
645
-
646
- </div><table class="source_code">
647
- <tr>
648
- <td>
649
- <pre class="lines">
650
-
651
-
652
- 142
653
- 143
654
- 144
655
- 145
656
- 146
657
- 147
658
- 148
659
- 149
660
- 150</pre>
661
- </td>
662
- <td>
663
- <pre class="code"><span class="info file"># File 'lib/workos/sso.rb', line 142</span>
664
-
665
- <span class='kw'>def</span> <span class='id identifier rubyid_promote_draft_connection'>promote_draft_connection</span><span class='lparen'>(</span><span class='label'>token:</span><span class='rparen'>)</span>
666
- <span class='id identifier rubyid_request'>request</span> <span class='op'>=</span> <span class='id identifier rubyid_bearer_post_request'>bearer_post_request</span><span class='lparen'>(</span>
667
- <span class='label'>path:</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>/draft_connections/</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_token'>token</span><span class='embexpr_end'>}</span><span class='tstring_content'>/activate</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span>
668
- <span class='rparen'>)</span>
669
-
670
- <span class='id identifier rubyid_response'>response</span> <span class='op'>=</span> <span class='id identifier rubyid_client'>client</span><span class='period'>.</span><span class='id identifier rubyid_request'>request</span><span class='lparen'>(</span><span class='id identifier rubyid_request'>request</span><span class='rparen'>)</span>
671
-
672
- <span class='id identifier rubyid_response'>response</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span> <span class='const'>Net</span><span class='op'>::</span><span class='const'>HTTPSuccess</span>
673
- <span class='kw'>end</span></pre>
674
- </td>
675
- </tr>
676
- </table>
677
- </div>
678
-
679
- </div>
680
-
681
- </div>
682
-
683
- <div id="footer">
684
- Generated on Tue Apr 7 22:21:07 2020 by
685
- <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
686
- 0.9.22 (ruby-2.7.1).
687
- </div>
688
-
689
- </div>
690
- </body>
691
- </html>