editor: "share -> create gist" never responds

Vega-Editor 0.91.1

the gist integration is great, except when i hit the create button in share -> create gist, after logging in to github and filling in info for the file. it never responds. everything works fine if i manually create the gist from within github.

i think it would be nice to have the create option under the gist tab too, sometimes i forget to look under share

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 15 (6 by maintainers)

Most upvoted comments

All you need the server for right now is to hide the client secret of your GitHub App by proxying it through a server. E.g. if your server just fires this on behalf of the user:

// Request token from GitHub
const data = new FormData();
data.append('client_id', YOUR_GH_CLIENT_ID);
data.append('client_secret', YOUR_GH_SECRET);
data.append('code', code);
const response = await fetch('https://github.com/login/oauth/access_token', {
    method: 'POST',
    body: data,
});

Your app secret stays hidden and you can return the access token to the user. Any further talking with the GitHub API (e.g. about gists) is then done directly between the Client and GitHub. You could also just throw this into a Cloudflare worker function tbh.

Ref: https://docs.github.com/en/developers/apps/building-oauth-apps/authorizing-oauth-apps#web-application-flow