Where to find stateSecret value
See original GitHub issueDescription
Hi everyone š First off, love Bolt - great job!
Iām following along with implementing oAuth for Bolt using the docs and have implemented the following - my issue is I canāt find how to get the correct value for stateSecret
?
How do you get this value to complete the oAuth flow so youāre able to authenticate and distribute your app?
const app = new App({
signingSecret: process.env.SLACK_SIGNING_SECRET,
clientId: process.env.SLACK_CLIENT_ID,
clientSecret: process.env.SLACK_CLIENT_SECRET,
stateSecret: 'my-state-secret', // where to find this value?
scopes: ['channels:read', 'groups:read', 'channels:manage', 'chat:write', 'incoming-webhook'],
installationStore: {
storeInstallation: async (installation) => {
// change the line below so it saves to your database
return await database.set(installation.team.id, installation);
},
fetchInstallation: async (InstallQuery) => {
// change the line below so it fetches from your database
return await database.get(InstallQuery.teamId);
},
},
});
Sorry if this is obvious, Iāve tried searching the docs and feel Iām missing something right in my face.
If I understand correctly, once the user is redirected via http://api.mydomain.com/slack/oauth_redirect
- this include the stateSecret? But how would I pass that value before the app is initalised? Iām not sure what Iām missing.
What type of issue is this? (place an x
in one of the [ ]
)
- bug
- enhancement (feature request)
- question
- documentation related
- example code related
- testing related
- discussion
Requirements (place an x
in each of the [ ]
)
- Iāve read and understood the Contributing guidelines and have done my best effort to follow them.
- Iāve read and agree to the Code of Conduct.
- Iāve searched for any related issues and avoided creating a duplicate issue.
Issue Analytics
- State:
- Created 3 years ago
- Comments:13 (5 by maintainers)
Top Results From Across the Web
OAuth - Slack Platform Developer Tools
This SDK is a collection of single-purpose packages. The packages are aimed at making building Slack apps easy, performant, secure, and scalable.
Read more ><activity> | Android Developers
When the value is " false ", the task may be cleared of activities in some situations (see the alwaysRetainTaskState attribute), but not...
Read more >definition of State secret by The Free Dictionary
Official information that has been determined to require, in the interests of national security, protection against unauthorized disclosure and which has beenĀ ...
Read more >LAW - on State Secret - Refworld
(1) The present Law sets the legal framework for state secret protection ... e) operations related to producing monetary signs and state value...
Read more >Government Warehousing of DNA a Disturbing State Secret ...
āWhile there is little disagreement over the value of newborn screening, what happens after the screening is causing a contentious debate nationwide,ā CCHFĀ ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hey @alexjackhughes!
Glad to hear you are loving bolt!
stateSecret
is something you come up with. Any random string. It is just to encode/decode the state when going through the OAuth flow. It will encode it when generating theAdd to Slack
url. Then when your redirect url is hit (http://api.mydomain.com/slack/oauth_redirect
), it will receive a payload from slack that returns thestate
value (which was the encoded one we passed when installing. ThestateSecret
will be used here to decode and verify state wasnāt tampered with by bad actors.Let me know if you have any follow up questions! If not, can you close the issue š
Hi @anthonygualandri,
This is a really good point. The document should encourage people to use an env variable for it too.
No, it isnāt but we know that some people may want to do so (see also: https://github.com/slackapi/bolt-js/issues/1205#issuecomment-966723613) We may enhance this part in future releases.