seratch / slack-edge

Slack app development framework for edge functions with streamlined TypeScript support
https://github.com/seratch/slack-edge-app-template
MIT License
87 stars 5 forks source link

Customization of the OAuth flow page rendering #26

Closed esstat17 closed 4 months ago

esstat17 commented 4 months ago

Kazuhiro, interesting project and keep it up.

are you open for Pull Request?

Any flexibility on render page?

slack-cloudflare-workers/node_modules/slack-edge/dist/oauth/oauth-page-renderer.js

It's hard coded. I am finding the other way to modifying it.

seratch commented 4 months ago

Hi @esstat17, thanks for using this library! Currently, you can customize the behavior by passing oauth.start to SlackApp constructor. I plan to add further options for only customizing the rendering part but for now, please go ahead with oauth.start.

seratch commented 4 months ago

Thanks for sharing this feedback! The options to customize the rendering logic are now available in v0.11.

esstat17 commented 4 months ago

Great job over the weekend! that was fast and this works for me.

new SlackOAuthApp({
// ...

oauth: {
  callback: async (args) => {
  const { oauthAccess }: OAuthCallbackArgs = args;
  console.log(oauthAccess); //  IDOR
  const { incoming_webhook } = oauthAccess;
  return new Response(JSON.stringify(incoming_webhook), {
    headers: { 'Content-Type': 'application/json' }
  });
}

I can now modify it without hardcoded HTML rendered even without utilizing the newly callbackRenderer

I will address here if i found any issues. Thank you!