Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 16 additions & 4 deletions app/en/guides/user-facing-agents/secure-auth-production/page.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -157,11 +157,17 @@ If the user's ID matches the ID specified at the start of the authorization flow
<Tabs.Tab>

```ts
// Either redirect to result.next_uri, or render a success page:
// Wait for the auth flow to be completed by the user:
const authResponse = await client.auth.waitForCompletion(result.auth_id);

if (authResponse.status === "completed") {
return "Thanks for authorizing!";
// Either redirect to a URL, or render your own success page:
return new Response(null, {
status: 303,
headers: {
Location: "https://your-app.com/auth/success",
},
});
} else {
return "Something went wrong. Please try again.";
}
Expand All @@ -171,11 +177,17 @@ if (authResponse.status === "completed") {
<Tabs.Tab>

```python
# Either redirect to result.next_uri, or render a success page:
from starlette.responses import Response

# Wait for the auth flow to be completed by the user:
auth_response = await client.auth.wait_for_completion(result.auth_id)

if auth_response.status == "completed":
return "Thanks for authorizing!"
# Either redirect to a URL, or render your own success page:
return Response(
status_code=303,
headers={"Location": "https://your-app.com/auth/success"}
)
else:
return "Something went wrong. Please try again."
```
Expand Down