discord/embedded-app-sdk

Tutorial not working, nothing happening after discordSdk.commands.authenticate()

GraceHopper0012 opened this issue · 11 comments

Tried everything, using console.log() statements every few lines and breakpoints. Execution stops at
auth = await discordSdk.commands.authenticate({ access_token, });

Just followed the tutorial at https://discord.com/developers/docs/activities/building-an-activity

No errors or anything, don't know what else to share, just lemme know what you need if you do need something else

I keep getting "OAuth2 Error: invalid_request: Missing "redirect_uri" in request."

This happens with my actual app, and when I clone the example code

Be sure your client as a proxy in his vite.config.js :

export default defineConfig({
  envDir: '..',
  server: {
    proxy: {
      '/api': {
        target: 'http://localhost:3001',
      },
    },
  },
  // ...
});

Otherwise your client points by default to ${CLIENT_URL}/api/token, but you want it to point to ${SERVER_URL}/api/token which is http://localhost:3001

Config looks like this:

import {defineConfig} from 'vite';

// https://vitejs.dev/config/
export default defineConfig({
  envDir: '../',
  server: {
    proxy: {
      '/api': {
        target: 'http://localhost:3001',
        changeOrigin: true,
        secure: false,
        ws: true,
      },
    },
    hmr: {
      clientPort: 443,
    },
  },
});

Btw @chadulous, you might wanna take a look at this

I am also having issues with the tutorial at https://discord.com/developers/docs/activities/building-an-activity. I'm unable to see any console.logs at all and cannot get past the part where you set the activity channel name. The app seems to run fine but console.logs never output in my terminal and the channel name does not show. I have zero errors as well.

Yeah we had the same issue, seems like logs aren't logged before discordSdk.ready() which took forever in some cases. But I do not know, why

Also, you have to be aware that the console.log() thing logs stuff in the client's console, for example on mobile you can export the activity logs where all those console.log()s are

UPDATE:

Now working with new created app, no clue why not working first try, maybe some setting, therefore leaving the issue open. But might help someone with the same problem.

Nope, just seems to be luck, some newly created applications work, some don't, no idea why

I keep getting "OAuth2 Error: invalid_request: Missing "redirect_uri" in request."

make sure you follow this step : OAuth2 redirect URI

As mentioned above, make sure you have something set for your OAuth2 redirect URI.