Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Save gist to user account when sharing #1114

Open
heaths opened this issue Nov 8, 2024 · 0 comments
Open

Save gist to user account when sharing #1114

heaths opened this issue Nov 8, 2024 · 0 comments

Comments

@heaths
Copy link

heaths commented Nov 8, 2024

Because we can't edit gists created by the Playground, I like to copy the content into my own account and add a comment linking back to the Playground e.g., https://gist.github.com/heaths/9ca334d400763698e0d4c895d495190a. This allows us to make some changes after some discussions and makes it easy to share so colleagues can modify the code in the Playground, try things out, look at different output, etc.

As a simplification of #609 the Playground could [prompt the user for authenticating(https://docs.github.com/apps/creating-github-apps/authenticating-with-a-github-app/generating-a-user-access-token-for-a-github-app) with the gist scope and call the gist creation API to create a private gist. The user token wouldn't need to be persisted, thus requiring a backend database, HttpOnly cookies, or the sort. Just keep it and the refresh token in memory.

Additionally, a comment could be added back to the Playground e.g., https://gist.github.com/heaths/9ca334d400763698e0d4c895d495190a?permalink_comment_id=5263599#gistcomment-5263599 (just the first bullet as a single line comment).

By keeping the refresh token in memory, the Playground could also support updates. If the gist already exists it could be updated, using the refresh token as needed. Similarly, if someone navigates to the Playground with an existing gist ID, the update API could be attempted. If it's not their gist the call would fail so there's no need to check authorization ahead of time.

An OAuth App would need to be created for the Playground.

For the UI, I was thinking of a drop-down button like some of the other existing ones. The default would be the existing behavior so no one is surprised, but in a drop-down you could have something like "Save to account".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant