Skip to content

incomplete_raw_credentials is thrown on slack user_token #3561

Open
@almeynman

Description

@almeynman

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions