How to set up authorization with OAuth in SlackAPP for new users?
up vote
0
down vote
favorite
I have a c#-based program that can send messages and files to our SlackWorkspace via my SlackApp (I'm using HttpClient
to communicate with Slack).
Now, to distribute this program in my workspace and to make it so that every user will have his own identity, it says that I have to use OAuth and create verification-tokens, specific for each user.
It says in the Slack-documentation I have to use a redirect-URL (as per docs) to my own server.
We have a server that I potentially could use for this. But I have never done anything like this before and I am unclear on what "answer" I have to provide from our server. I thought the verification-process would be handled by Slack.
Anyone has an idea on how to approach this?
And before anyone asks - yes we need to install it for everyone and make them identifiable as themselves. We can't use the "SlackApp" as user. :)
I would be very grateful for code examples(in c#) and explanations on how this whole redirect-thing is working.
c# oauth-2.0 slack-api
add a comment |
up vote
0
down vote
favorite
I have a c#-based program that can send messages and files to our SlackWorkspace via my SlackApp (I'm using HttpClient
to communicate with Slack).
Now, to distribute this program in my workspace and to make it so that every user will have his own identity, it says that I have to use OAuth and create verification-tokens, specific for each user.
It says in the Slack-documentation I have to use a redirect-URL (as per docs) to my own server.
We have a server that I potentially could use for this. But I have never done anything like this before and I am unclear on what "answer" I have to provide from our server. I thought the verification-process would be handled by Slack.
Anyone has an idea on how to approach this?
And before anyone asks - yes we need to install it for everyone and make them identifiable as themselves. We can't use the "SlackApp" as user. :)
I would be very grateful for code examples(in c#) and explanations on how this whole redirect-thing is working.
c# oauth-2.0 slack-api
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I have a c#-based program that can send messages and files to our SlackWorkspace via my SlackApp (I'm using HttpClient
to communicate with Slack).
Now, to distribute this program in my workspace and to make it so that every user will have his own identity, it says that I have to use OAuth and create verification-tokens, specific for each user.
It says in the Slack-documentation I have to use a redirect-URL (as per docs) to my own server.
We have a server that I potentially could use for this. But I have never done anything like this before and I am unclear on what "answer" I have to provide from our server. I thought the verification-process would be handled by Slack.
Anyone has an idea on how to approach this?
And before anyone asks - yes we need to install it for everyone and make them identifiable as themselves. We can't use the "SlackApp" as user. :)
I would be very grateful for code examples(in c#) and explanations on how this whole redirect-thing is working.
c# oauth-2.0 slack-api
I have a c#-based program that can send messages and files to our SlackWorkspace via my SlackApp (I'm using HttpClient
to communicate with Slack).
Now, to distribute this program in my workspace and to make it so that every user will have his own identity, it says that I have to use OAuth and create verification-tokens, specific for each user.
It says in the Slack-documentation I have to use a redirect-URL (as per docs) to my own server.
We have a server that I potentially could use for this. But I have never done anything like this before and I am unclear on what "answer" I have to provide from our server. I thought the verification-process would be handled by Slack.
Anyone has an idea on how to approach this?
And before anyone asks - yes we need to install it for everyone and make them identifiable as themselves. We can't use the "SlackApp" as user. :)
I would be very grateful for code examples(in c#) and explanations on how this whole redirect-thing is working.
c# oauth-2.0 slack-api
c# oauth-2.0 slack-api
edited 6 hours ago
Erik Kalkoken
11.5k32145
11.5k32145
asked 18 hours ago
Fabian Held
347
347
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
up vote
0
down vote
From the Slack API wiki:
https://github.com/Inumedia/SlackAPI/wiki/Examples
Getting Authentication token from email and password:
SlackClient.StartAuth((authStartResponse) =>{
// Here authStartResponse has a field ('users') containing a list of teams you have access to.
SlackClient.AuthSignin(
(authSigninResponse) =>{
//Here, authSigninResponse contains a field 'token' which is your valid authentication token.
},
authStartResponse.users[0].user_id,
authStartResponse.users[1].team_id,
YOUR_PASSWORD_HERE
);
}, YOUR_EMAIL_HERE);
There is also much more in the wiki of how to do everything. The question is, how do you choose to get everybody's email and password for slack. If this is an inside work thing and security is not an issue, just have them enter their password and email at some point and time that you can then use inside of the method above. What kind of app is it? I could be more specific to the platform.
Thanks for your contribution. I am however a bit skeptical whether this really is a solution. 1) Your are not linking to the official Slack API, but to a 3rd party library called "SlackAPI" 2) The standard OAuth process does not require email and password to be provided (which btw would be huge security concern). So I doubt this actually works.
– Erik Kalkoken
4 hours ago
add a comment |
up vote
0
down vote
Slack uses the standard Oauth 2.0 protocol to authenticate apps, similar to Google and Facebook.
To enable a Slack app to generate tokens via Oauth a web app is needed:
- can be reached from the Internet
- able to handle HTTP requests like a web server
- has persistent storage for the newly generated tokens
For the local development of such a web app its recommend to use a VPN tunnel like ngrok, that allows one to expose a local machine securely to the Internet and Slack.
Main concepts for implementing such a solutions in C# with .NET core include:
HttpListener
class for providing fundamental ability to listen and respond to HTTP requests- Multi-threading of HttpListener
- Cookies / Session handling
- MD5 hashes
The details go a bit beyond the scope of one answer. But I am happy to share a working example implementation on this GitHubGist.
add a comment |
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
From the Slack API wiki:
https://github.com/Inumedia/SlackAPI/wiki/Examples
Getting Authentication token from email and password:
SlackClient.StartAuth((authStartResponse) =>{
// Here authStartResponse has a field ('users') containing a list of teams you have access to.
SlackClient.AuthSignin(
(authSigninResponse) =>{
//Here, authSigninResponse contains a field 'token' which is your valid authentication token.
},
authStartResponse.users[0].user_id,
authStartResponse.users[1].team_id,
YOUR_PASSWORD_HERE
);
}, YOUR_EMAIL_HERE);
There is also much more in the wiki of how to do everything. The question is, how do you choose to get everybody's email and password for slack. If this is an inside work thing and security is not an issue, just have them enter their password and email at some point and time that you can then use inside of the method above. What kind of app is it? I could be more specific to the platform.
Thanks for your contribution. I am however a bit skeptical whether this really is a solution. 1) Your are not linking to the official Slack API, but to a 3rd party library called "SlackAPI" 2) The standard OAuth process does not require email and password to be provided (which btw would be huge security concern). So I doubt this actually works.
– Erik Kalkoken
4 hours ago
add a comment |
up vote
0
down vote
From the Slack API wiki:
https://github.com/Inumedia/SlackAPI/wiki/Examples
Getting Authentication token from email and password:
SlackClient.StartAuth((authStartResponse) =>{
// Here authStartResponse has a field ('users') containing a list of teams you have access to.
SlackClient.AuthSignin(
(authSigninResponse) =>{
//Here, authSigninResponse contains a field 'token' which is your valid authentication token.
},
authStartResponse.users[0].user_id,
authStartResponse.users[1].team_id,
YOUR_PASSWORD_HERE
);
}, YOUR_EMAIL_HERE);
There is also much more in the wiki of how to do everything. The question is, how do you choose to get everybody's email and password for slack. If this is an inside work thing and security is not an issue, just have them enter their password and email at some point and time that you can then use inside of the method above. What kind of app is it? I could be more specific to the platform.
Thanks for your contribution. I am however a bit skeptical whether this really is a solution. 1) Your are not linking to the official Slack API, but to a 3rd party library called "SlackAPI" 2) The standard OAuth process does not require email and password to be provided (which btw would be huge security concern). So I doubt this actually works.
– Erik Kalkoken
4 hours ago
add a comment |
up vote
0
down vote
up vote
0
down vote
From the Slack API wiki:
https://github.com/Inumedia/SlackAPI/wiki/Examples
Getting Authentication token from email and password:
SlackClient.StartAuth((authStartResponse) =>{
// Here authStartResponse has a field ('users') containing a list of teams you have access to.
SlackClient.AuthSignin(
(authSigninResponse) =>{
//Here, authSigninResponse contains a field 'token' which is your valid authentication token.
},
authStartResponse.users[0].user_id,
authStartResponse.users[1].team_id,
YOUR_PASSWORD_HERE
);
}, YOUR_EMAIL_HERE);
There is also much more in the wiki of how to do everything. The question is, how do you choose to get everybody's email and password for slack. If this is an inside work thing and security is not an issue, just have them enter their password and email at some point and time that you can then use inside of the method above. What kind of app is it? I could be more specific to the platform.
From the Slack API wiki:
https://github.com/Inumedia/SlackAPI/wiki/Examples
Getting Authentication token from email and password:
SlackClient.StartAuth((authStartResponse) =>{
// Here authStartResponse has a field ('users') containing a list of teams you have access to.
SlackClient.AuthSignin(
(authSigninResponse) =>{
//Here, authSigninResponse contains a field 'token' which is your valid authentication token.
},
authStartResponse.users[0].user_id,
authStartResponse.users[1].team_id,
YOUR_PASSWORD_HERE
);
}, YOUR_EMAIL_HERE);
There is also much more in the wiki of how to do everything. The question is, how do you choose to get everybody's email and password for slack. If this is an inside work thing and security is not an issue, just have them enter their password and email at some point and time that you can then use inside of the method above. What kind of app is it? I could be more specific to the platform.
answered 6 hours ago
The.NetDeveloper
13
13
Thanks for your contribution. I am however a bit skeptical whether this really is a solution. 1) Your are not linking to the official Slack API, but to a 3rd party library called "SlackAPI" 2) The standard OAuth process does not require email and password to be provided (which btw would be huge security concern). So I doubt this actually works.
– Erik Kalkoken
4 hours ago
add a comment |
Thanks for your contribution. I am however a bit skeptical whether this really is a solution. 1) Your are not linking to the official Slack API, but to a 3rd party library called "SlackAPI" 2) The standard OAuth process does not require email and password to be provided (which btw would be huge security concern). So I doubt this actually works.
– Erik Kalkoken
4 hours ago
Thanks for your contribution. I am however a bit skeptical whether this really is a solution. 1) Your are not linking to the official Slack API, but to a 3rd party library called "SlackAPI" 2) The standard OAuth process does not require email and password to be provided (which btw would be huge security concern). So I doubt this actually works.
– Erik Kalkoken
4 hours ago
Thanks for your contribution. I am however a bit skeptical whether this really is a solution. 1) Your are not linking to the official Slack API, but to a 3rd party library called "SlackAPI" 2) The standard OAuth process does not require email and password to be provided (which btw would be huge security concern). So I doubt this actually works.
– Erik Kalkoken
4 hours ago
add a comment |
up vote
0
down vote
Slack uses the standard Oauth 2.0 protocol to authenticate apps, similar to Google and Facebook.
To enable a Slack app to generate tokens via Oauth a web app is needed:
- can be reached from the Internet
- able to handle HTTP requests like a web server
- has persistent storage for the newly generated tokens
For the local development of such a web app its recommend to use a VPN tunnel like ngrok, that allows one to expose a local machine securely to the Internet and Slack.
Main concepts for implementing such a solutions in C# with .NET core include:
HttpListener
class for providing fundamental ability to listen and respond to HTTP requests- Multi-threading of HttpListener
- Cookies / Session handling
- MD5 hashes
The details go a bit beyond the scope of one answer. But I am happy to share a working example implementation on this GitHubGist.
add a comment |
up vote
0
down vote
Slack uses the standard Oauth 2.0 protocol to authenticate apps, similar to Google and Facebook.
To enable a Slack app to generate tokens via Oauth a web app is needed:
- can be reached from the Internet
- able to handle HTTP requests like a web server
- has persistent storage for the newly generated tokens
For the local development of such a web app its recommend to use a VPN tunnel like ngrok, that allows one to expose a local machine securely to the Internet and Slack.
Main concepts for implementing such a solutions in C# with .NET core include:
HttpListener
class for providing fundamental ability to listen and respond to HTTP requests- Multi-threading of HttpListener
- Cookies / Session handling
- MD5 hashes
The details go a bit beyond the scope of one answer. But I am happy to share a working example implementation on this GitHubGist.
add a comment |
up vote
0
down vote
up vote
0
down vote
Slack uses the standard Oauth 2.0 protocol to authenticate apps, similar to Google and Facebook.
To enable a Slack app to generate tokens via Oauth a web app is needed:
- can be reached from the Internet
- able to handle HTTP requests like a web server
- has persistent storage for the newly generated tokens
For the local development of such a web app its recommend to use a VPN tunnel like ngrok, that allows one to expose a local machine securely to the Internet and Slack.
Main concepts for implementing such a solutions in C# with .NET core include:
HttpListener
class for providing fundamental ability to listen and respond to HTTP requests- Multi-threading of HttpListener
- Cookies / Session handling
- MD5 hashes
The details go a bit beyond the scope of one answer. But I am happy to share a working example implementation on this GitHubGist.
Slack uses the standard Oauth 2.0 protocol to authenticate apps, similar to Google and Facebook.
To enable a Slack app to generate tokens via Oauth a web app is needed:
- can be reached from the Internet
- able to handle HTTP requests like a web server
- has persistent storage for the newly generated tokens
For the local development of such a web app its recommend to use a VPN tunnel like ngrok, that allows one to expose a local machine securely to the Internet and Slack.
Main concepts for implementing such a solutions in C# with .NET core include:
HttpListener
class for providing fundamental ability to listen and respond to HTTP requests- Multi-threading of HttpListener
- Cookies / Session handling
- MD5 hashes
The details go a bit beyond the scope of one answer. But I am happy to share a working example implementation on this GitHubGist.
edited 1 hour ago
answered 2 hours ago
Erik Kalkoken
11.5k32145
11.5k32145
add a comment |
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53371810%2fhow-to-set-up-authorization-with-oauth-in-slackapp-for-new-users%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown