|
203 | 203 | "\n",
|
204 | 204 | "Once you have this deployed, you can go check out the application on AWS Lambda:\n",
|
205 | 205 | "\n",
|
206 |
| - "\n", |
| 206 | + "\n", |
207 | 207 | "\n",
|
208 | 208 | "You can confirm that the function is not reachable unless authenticated by running a curl command without any authentication:\n",
|
209 | 209 | "\n",
|
|
239 | 239 | "\n",
|
240 | 240 | "Let's now make sure we create a webpage/domain on which we can log-in. Go to AWS Cognito, select the newly created user pool & go to App Integration tab:\n",
|
241 | 241 | "\n",
|
242 |
| - "\n", |
| 242 | + "\n", |
243 | 243 | "\n",
|
244 | 244 | "Create a Cognito Domain by clicking on \"Domains\" then \"Create Cognito Domain\"\n",
|
245 | 245 | "\n",
|
246 |
| - "\n", |
| 246 | + "\n", |
247 | 247 | "\n",
|
248 | 248 | "Scroll down to `App client list` on the App Integration page of your User Pool:\n",
|
249 | 249 | "\n",
|
250 |
| - "\n", |
| 250 | + "\n", |
251 | 251 | "\n",
|
252 | 252 | "Select your app client and edit the Hosted UI:\n",
|
253 | 253 | "\n",
|
254 |
| - "\n", |
| 254 | + "\n", |
255 | 255 | "\n",
|
256 | 256 | "And add a callback URL, Authorization Scheme and OAuth scope:\n",
|
257 | 257 | "\n",
|
258 |
| - "\n", |
| 258 | + "\n", |
259 | 259 | "\n",
|
260 | 260 | "_Note that you'll come back to this step when ChatGPT will generate a callback URL for the authentication of your action. The postman URL, should be used only for development purpose._\n",
|
261 | 261 | "\n",
|
262 | 262 | "You can try this connection in Postman, under Authorization for your `<api_url>`, copy/paste the value from AWS for the client_id, client_secret and the URL you set up for the auth domain, make sure to add `openid` in the scope to get a valid access_token:\n",
|
263 | 263 | "\n",
|
264 |
| - "\n", |
| 264 | + "\n", |
265 | 265 | "\n",
|
266 |
| - "\n", |
| 266 | + "\n", |
267 | 267 | "\n",
|
268 | 268 | "If you're now doing the request on Postman, using the access_token you just retrieve, you'll get a success JSON returned:\n",
|
269 | 269 | "\n",
|
270 |
| - "" |
| 270 | + "" |
271 | 271 | ]
|
272 | 272 | },
|
273 | 273 | {
|
|
320 | 320 | "Click on Authentication > OAuth.\n",
|
321 | 321 | "We'll now need to fetch AWS Cognito's variables. Let's go on your User Pool > User Pool App Client. From there you can retrieve your client ID and client Secret.\n",
|
322 | 322 | "\n",
|
323 |
| - "\n", |
| 323 | + "\n", |
324 | 324 | "\n",
|
325 | 325 | "Copy paste those values in ChatGPT. Now let's add the Token URLs.\n",
|
326 | 326 | "\n",
|
327 | 327 | "From your User Pool you'll find the URL you've previously created for the hosted domain.\n",
|
328 | 328 | "\n",
|
329 |
| - "\n", |
| 329 | + "\n", |
330 | 330 | "\n",
|
331 | 331 | "We'll take this URL and append [AWS routes for OAuth](https://docs.aws.amazon.com/cognito/latest/developerguide/federation-endpoints.html).\n",
|
332 | 332 | "\n",
|
|
351 | 351 | "source": [
|
352 | 352 | "Now go back on your GPT (moving out of the action subview), and you'll see a callback URL provided by ChatGPT for the Authentication:\n",
|
353 | 353 | "\n",
|
354 |
| - "\n", |
| 354 | + "\n", |
355 | 355 | "\n",
|
356 | 356 | "Get this URL and edit the hosted UI of your User Pool App client & save the changes:\n",
|
357 | 357 | "\n",
|
358 |
| - "" |
| 358 | + "" |
359 | 359 | ]
|
360 | 360 | },
|
361 | 361 | {
|
|
371 | 371 | "source": [
|
372 | 372 | "You can now test this action again:\n",
|
373 | 373 | "\n",
|
374 |
| - "\n", |
| 374 | + "\n", |
375 | 375 | "\n",
|
376 | 376 | "You will be redirected to AWS Cognito page, which you can log-in in using the credentials previously set-up.\n",
|
377 | 377 | "\n",
|
378 | 378 | "If you now ask the GPT to run the same action, it will answer correctly as you're now authenticated and able to run this function!\n",
|
379 | 379 | "\n",
|
380 |
| - "" |
| 380 | + "" |
381 | 381 | ]
|
382 | 382 | },
|
383 | 383 | {
|
|
0 commit comments