HackYourFuture-CPH / web-dev-rooms

Final project for HYF class14
https://develop-web-dev-rooms.herokuapp.com
MIT License
0 stars 4 forks source link

API: Endpoint for Slack Authentication #58

Closed dpfernandes closed 3 years ago

dpfernandes commented 3 years ago

Create an endpoint that uses the User's Slack ID and Token to authenticate with our app and retrieves the SlackID and Name of the user.

The endpoint could also retrieve the User groups that the specific user is part of, like the class user group.

image

orhantoy commented 3 years ago

@dpfernandes I'm here at the study group with Nuha and it is a bit unclear to both of us what the specific work needed for this issue is. I think the work needed is to integrate with the Slack API but I could be wrong.

Questions:

Here's what I think the work needed is but please fill free to correct me or fill in missing pieces:

And lastly Daniel, it would be nice to understand in which context this endpoint will be used (which screens on the frontend).

dpfernandes commented 3 years ago

This issue is to solve the authentication for the app using Slack authentication It should validate if the user has an account in our slack workspace and if the user is part of any user group so we know it’s part of a class or by default if it’s not they should be considered mentors

I think it’s fine if the endpoint just validates if the user has an account and returns the token

The screenshot is to show a user group

I think your approach it fine

Can you elaborate on the this “And lastly Daniel, it would be nice to understand in which context this endpoint will be used (which screens on the frontend).”?

orhantoy commented 3 years ago

Can you elaborate on this

Basically, I mean when would this endpoint be called, originated from which page on the frontend?

orhantoy commented 3 years ago

This is the desired behavior I understand from https://github.com/HackYourFuture-CPH/web-dev-rooms/issues/58#issuecomment-733660806:

POST /api/slack/auth
Request: { "slackUserId": "xyz" }
Response: { "slackUserId": "xyz", "name": "John Appleseed", "userGroups": [{ "id": "...", "name": "Class 15" }] }

It sounds like the Slack authentication token will come from an environment variable.

@dpfernandes Does this sound correct?

dpfernandes commented 3 years ago

It seems right! :)

Any opinions @tpetrina and @bytewiz ?