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

incomplete_raw_credentials is thrown on slack user_token #3561

Open
almeynman opened this issue Feb 22, 2025 · 1 comment
Open

incomplete_raw_credentials is thrown on slack user_token #3561

almeynman opened this issue Feb 22, 2025 · 1 comment

Comments

@almeynman
Copy link

Might be related to this one #3560

I want to obtain slack user token, not bot token

So when I trigger connection with the following code.

      const connectSession = await createConnectSession.mutateAsync({
        integrationId: selectedIntegration.id,
      });
      new Nango({
        connectSessionToken: connectSession.token,
      })
        .auth(
          selectedIntegration.id,
          selectedIntegration.provider.id === 'slack'
            ? {
                authorization_params: {
                  user_scope: // <---- supplying user scopes like this works
                    'channels:history,channels:read,channels:write,channels:write.topic,chat:write',
                },
                user_scope: [ // <---- supplying user scopes like this does not works
                  'channels:history',
                  'channels:read',
                  'channels:write',
                  'channels:write.topic',
                  'chat:write',
                ],
              }
            : {},
        )
        .then((_result) => {

In Nango Console > Logs I see the following

Image

This is the content of the failing log, with some data redacted.

{
  "rawCredentials": {
    "authed_user": {
      "access_token": "access token",
      "scope": "channels:history,groups:history,im:history,mpim:history,channels:read,groups:read,im:read,mpim:read,reactions:read,reminders:read,team:read,users:read,users:read.email,users.profile:read,channels:write,chat:write,groups:write,im:write,im:write.topic,mpim:write,mpim:write.topic,reactions:write,reminders:write,users:write,users.profile:write,channels:write.topic,groups:write.topic",
      "id": "user id",
      "token_type": "user"
    },
    "enterprise": null,
    "is_enterprise_install": false,
    "team": {
      "name": "Proxi",
      "id": "slack team id"
    },
    "ok": true,
    "app_id": "my app id"
  },
  "error": {
    "message": "An unhandled error of type 'incomplete_raw_credentials' with payload '{}' has occurred",
    "payload": {}
  }
}

I tracked the issue down to this line.

Seems like parseRawCredentials expects to find access_token at the root, but it's under authed_user, i.e. authed_user.access_token.

Copy link

linear bot commented Feb 22, 2025

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