Description
Currently, I am developing a slack app, build with bolt. I have implemented OAuth as suggested here. So, naturally bolt has created this endpoint /slack/install for installing and authorizing the slack app into a workspace, when I (the creator) click it and try to authorize it, it works perfectly fine, however from time to time with some small issuers, but when somebody else from the exterior does it, it always throws an error: Something went wrong when authorizing this app.. Logs:
[DEBUG] web-api:WebClient:0 initialized
[DEBUG] web-api:WebClient:0 apiCall('oauth.v2.access') start
[DEBUG] web-api:WebClient:0 will perform http request
[DEBUG] web-api:WebClient:0 http response received
[DEBUG] web-api:WebClient:1 initialized
[DEBUG] web-api:WebClient:1 apiCall('auth.test') start
[DEBUG] web-api:WebClient:1 will perform http request
[DEBUG] web-api:WebClient:1 http response received
[DEBUG] web-api:WebClient:2 initialized
[DEBUG] web-api:WebClient:2 apiCall('auth.test') start
[DEBUG] web-api:WebClient:2 will perform http request
[DEBUG] web-api:WebClient:2 http response received
[ERROR] OAuth:InstallProvider:0 Error: An API error occurred: invalid_auth
at Object.platformErrorFromResult (/path-to-/node_modules/@slack/web-api/dist/errors.js:51:33)
at WebClient.apiCall (/path-to-/node_modules/node_modules/@slack/web-api/dist/WebClient.js:158:28)
at processTicksAndRejections (internal/process/task_queues.js:93:5) {
code: 'slack_webapi_platform_error',
data: {
ok: false,
error: 'invalid_auth',
response_metadata: { scopes: [Array] }
}
}
[DEBUG] OAuth:InstallProvider:0 calling passed in options.failure
What type of issue is this? (place an x in one of the [ ])
Requirements (place an x in each of the [ ])
Bug Report
Here is the code:
import { App, LogLevel, ExpressReceiver } from '@slack/bolt';
import { Low, JSONFile } from 'lowdb';
import { join } from 'path';
import { sendWelcomeMessage } from './views/messages.js';
import { createUserProfile } from './auth/authGetTilo.js';
import { newUserHomePage } from './views/homePage.js';
const file = join('./db.json');
const adapter = new JSONFile(file);
const db = new Low(adapter);
const receiver = new ExpressReceiver({
signingSecret: process.env.SLACK_SIGNING_SECRET,
logLevel: LogLevel.DEBUG,
clientId: process.env.SLACK_CLIENT_ID,
clientSecret: process.env.SLACK_CLIENT_SECRET,
stateSecret: 'someStateSecret',
scopes: ['commands', 'chat:write'],
installationStore: {
storeInstallation: async (installation) => {
// change the line below so it saves to your database
console.log('installation', installation);
await db.read();
db.data = db.data || {};
db.data.installation = installation;
await db.write();
// save to db
sendWelcomeMessage(app, installation);
createUserProfile(app, installation, db)
},
fetchInstallation: async (installQuery) => {
// change the line below so it fetches from your database
console.log('installQuery', installQuery);
await db.read();
if (db.data.installation) {
return db.data.installation;
}
throw new Error('Failed fetching installation');
},
deleteInstallation: async (installQuery) => {
// change the line below so it deletes from your database
},
},
installerOptions: {
userScopes: ['identity.basic', 'identity.email'],
callbackOptions: {
success: (installation, installOptions, req, res) => {
res.end('success');
},
failure: (error, installOptions, req, res) => {
res.end('failure');
},
},
},
});
const app = new App({ receiver });
// All the room in the world for your code
app.event('app_home_opened', params => newUserHomePage(params, db));
(async () => {
// Start your app
await app.start(process.env.PORT || 3000);
console.log('⚡️ Bolt app is running!');
})();
please ignore the LowDB part, it's just for testing
Reproducible in:
package version: "^3.5.0"
node version: v14.13.1
OS version(s): macOS Big Sur
Expected result:
Users are able to correctly authorize the app
Actual result:
An error is being thrown, without any message on how to solve it
Description
Currently, I am developing a slack app, build with
bolt. I have implemented OAuth as suggested here. So, naturallybolthas created this endpoint/slack/installfor installing and authorizing the slack app into a workspace, when I (the creator) click it and try to authorize it, it works perfectly fine, however from time to time with some small issuers, but when somebody else from the exterior does it, it always throws an error:Something went wrong when authorizing this app.. Logs:What type of issue is this? (place an
xin one of the[ ])Requirements (place an
xin each of the[ ])Bug Report
Here is the code:
please ignore the LowDB part, it's just for testing
Reproducible in:
package version: "^3.5.0"
node version: v14.13.1
OS version(s): macOS Big Sur
Expected result:
Users are able to correctly authorize the app
Actual result:
An error is being thrown, without any message on how to solve it