here's some background of what I'm trying to do. I do not have admin access to my organization Okta enterprise. What I'm trying to do is to login to Okta programatically, and then subsequently login to Slack via Okta SSO so that I can grab the access token. The reason for this is all authentication/authorization is hidden behind Okta, and I want this Slack access token to retrieve my own Slack message so that I can create custom scripts to retrieve, write message on behalf of myself.
Note that all I have is my own username and password credentials with MFA.
I have tried the following.
- Login to Okta via browser programatically using go-rod. Which I managed to do so successfully, but I'm failing to load up Slack as it's stuck in the browser loader screen for Slack.
- I tried to authenticate via Okta RESTful API. So far, I have managed to authenticate using
{{domain}}/api/v1/authn, and then subsequently using MFA via the verify endpoint{{domain}}/api/v1/authn/factors/{{factorID}}/verifywhich returns me asessionToken. From here, I can successfully create a sessionCookie which have proven quite useless to me. Perhaps I am doing it wrongly.
I'd like to expand deeper into Approach #2. I still haven't figured out the exact way to authenticate to Slack programatically via SSO. All I have at this point is
- Username
- Password
- MFA
- SessionToken
- Follow through into
{{domain}}/api/v1/sessionswhich returns me- id
- userId
- idp
- id
- type etc
- Follow through into
- SessionCookie (Useless?)
I'm pretty much stuck here. I don't have a client_id/client_secret. I have been playing around with /oauth/v1/token and /oauth/v1/authorize but with disappointing results.
I even tried using this CLI package (https://github.com/oktadev/pkce-cli) but I'm just getting 400 bad request with the authorize URL generated. So I know I'm doing something wrong for sure.
Any help is appreciated! I have spent days to weeks on this.