Skip to content

Conversation

tom-sherman
Copy link
Contributor

@tom-sherman tom-sherman commented Jul 29, 2025

Draft for now because it doesn't work lol. Also will need to split out the database change and merge/migrate that before. Do not be scared by the number of lines changed, this is mostly (+1159 lines) the db migration snapshot 😆

This is the first step in implementing user email storage. Will also lay the groundwork for requesting new scopes when oauth scopes are shipped in atproto.

This involves sending the user back through the Auth flow with the additional scopes attached (including the old ones too)

The way this PR implements this is to store the scopes that the user logs in with in my session database, then when they use the app with different scopes to what we currently require (check in middleware), reauthenticate them as above.

We don't reauthenticate the user without telling them what's happening, they'll be presented with a page (/reauthenticate) beforehand (design still WIP):

image

Copy link

vercel bot commented Jul 29, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
frontpage Ready Ready Preview Comment Oct 3, 2025 9:35pm
3 Skipped Deployments
Project Deployment Preview Comments Updated (UTC)
atproto-browser Skipped Skipped Oct 3, 2025 9:35pm
frontpage-oauth-preview-client Skipped Skipped Oct 3, 2025 9:35pm
unravel Skipped Skipped Oct 3, 2025 9:35pm

@vercel vercel bot temporarily deployed to Preview – frontpage-oauth-preview-client July 29, 2025 13:56 Inactive
@vercel vercel bot temporarily deployed to Preview – unravel July 29, 2025 13:56 Inactive
@vercel vercel bot temporarily deployed to Preview – atproto-browser July 29, 2025 13:56 Inactive
@vercel vercel bot temporarily deployed to Preview – atproto-browser July 29, 2025 13:58 Inactive
@vercel vercel bot temporarily deployed to Preview – unravel July 29, 2025 13:58 Inactive
@vercel vercel bot temporarily deployed to Preview – frontpage-oauth-preview-client July 29, 2025 13:58 Inactive
appUrl: string;
};

export const AUTH_SCOPES = "atproto transition:generic";
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If everything works correctly in this PR it should just be a matter of deploying the app with new scopes here. This can be done as a followup PR when implementing user email storage.

if (!session) {
redirect("/login?error=You've been logged out. Please log in again.");
}
const result = await signIn({
Copy link
Contributor Author

@tom-sherman tom-sherman Jul 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this is successful we should probably delete the old session here. Could just leave it orphaned and let it expire naturally tho.

@vercel vercel bot temporarily deployed to Preview – frontpage-oauth-preview-client July 30, 2025 11:37 Inactive
@vercel vercel bot temporarily deployed to Preview – atproto-browser July 30, 2025 11:37 Inactive
@vercel vercel bot temporarily deployed to Preview – unravel July 30, 2025 11:37 Inactive
@vercel vercel bot temporarily deployed to Preview – frontpage-oauth-preview-client July 30, 2025 13:34 Inactive
@vercel vercel bot temporarily deployed to Preview – unravel July 30, 2025 13:34 Inactive
@vercel vercel bot temporarily deployed to Preview – atproto-browser July 30, 2025 13:34 Inactive
@tom-sherman tom-sherman force-pushed the reauthenticate-flow branch from c0f7df3 to 93770f6 Compare August 3, 2025 20:41
@vercel vercel bot temporarily deployed to Preview – unravel August 3, 2025 20:41 Inactive
@vercel vercel bot temporarily deployed to Preview – atproto-browser August 3, 2025 20:41 Inactive
@vercel vercel bot temporarily deployed to Preview – unravel August 3, 2025 20:49 Inactive
@vercel vercel bot temporarily deployed to Preview – atproto-browser August 3, 2025 20:49 Inactive
@vercel vercel bot temporarily deployed to Preview – frontpage-oauth-preview-client August 3, 2025 20:49 Inactive
@vercel vercel bot temporarily deployed to Preview – atproto-browser September 6, 2025 09:40 Inactive
@vercel vercel bot temporarily deployed to Preview – unravel September 6, 2025 09:40 Inactive
@vercel vercel bot temporarily deployed to Preview – frontpage-oauth-preview-client September 6, 2025 09:40 Inactive
@vercel vercel bot temporarily deployed to Preview – unravel October 3, 2025 21:30 Inactive
@vercel vercel bot temporarily deployed to Preview – frontpage-oauth-preview-client October 3, 2025 21:30 Inactive
@vercel vercel bot temporarily deployed to Preview – atproto-browser October 3, 2025 21:30 Inactive
@vercel vercel bot temporarily deployed to Preview – frontpage-oauth-preview-client October 3, 2025 21:34 Inactive
@vercel vercel bot temporarily deployed to Preview – atproto-browser October 3, 2025 21:34 Inactive
@vercel vercel bot temporarily deployed to Preview – unravel October 3, 2025 21:34 Inactive
@tom-sherman
Copy link
Contributor Author

Split into stacked PRs #272

@tom-sherman tom-sherman closed this Oct 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant