I managed to set up oauth2 with Slack. Now, once the user signs in with Slack, if the user is a new user, I want to get the user workspace id (which I should get through the api call) and do create a new “group” in my bubble database.
How, can I get these other data from the oauth2 sign in, as from what I see what we get from that is only user sign up or log in?
I read again some information and even if doc seem to say user auth for endpoint, if you use the slack “signin” option, they are not available until you do a request for authorize with other scopes with the “regular” oauth process.
Because Bubble cannot work with the payload for the token to get the user profile, the best option could be to add another step after the signin process to fetch bot or user (more scopes) after the signin. So when the user is back after the redirect, you send them back to authorize url with bot scopes request. This request should use a different redirect URL. Take the code provided and exchance it for access token for bot and user. Store this information with current user (or any related DB) with correct privacy rules applied (only logged in and current user should be able to get this field)
Use link and information from this page Installing with OAuth | Slack to fetch the bot token
i agree it’s not simple with slack. A part is how Bubble auth work and another part is how Slack work. With the actual settings you have, you have the slack user ID with the profile enpoint that you can call with the user token (Just add a call that get https://slack.com/api/openid.connect.userInfo)
@Jici Indeed, this seems to be it. The only thing that I would want to know is: how can I automatically make this call once a user signs in with slack? So user signs in with slack → I get openid.connect.userInfo → conditional: if user’s id is empty do this etc…
Just add another step after Signup with social network > make change to current user (only when current user slack ID is emtpy). Set the slack ID field with Get data from API connector with the call yo openid.cnnect.userinfo.
This call must be added by you under the Slack API in API Connector. You cannot use the one set in the authentication.