Not able to authenticate with Okta
Describe the bug We are trying to configure Dispatch with Okta and are not able to authenticate.
Docs Used: https://hawkins.gitbook.io/dispatch/administration-guide/server#authentication Okta: Developer account Dispatch Commit: 39a1e99c126e270361d59e23710012ab9141946e
To Reproduce Steps to reproduce the behavior: 0. Configure as described Using Okta login URL:
- Navigate to Okta login/embed URL
- Be redirected to https://dispatch.XXXXXXXX.XXX/implicit/callback?iss=https://dev-XXXXXXXX.okta.com
- Be redirected to https://dispatch.XXXXXXXX.XXX/default/auth/login
- Observe login page 4a. Observe 401 in console with no auth headers Response: {"detail":[{"msg":"Could not validate credentials"}]} Request URL: https://dispatch.XXXXXXXX.XXX/api/v1/organizations?itemsPerPage=50&sortBy[]=name&descending[]=false&filter={"and":[{"model":"Organization","field":"name","op":"==","value":"default"}]}
Navigating to Dispatch directly:
- Navigate to https://dispatch.XXXXXXXX.XXX/
- Be redirected to https://dispatch.XXXXXXXX.XXX/default/auth/login
- Observe login page
- Observe the same 401 described above
Expected behavior I expect to be able to navigate to https://dispatch.mycompany.com/* and be redirected to login via Okta. -or- I expect to navigate to the Okta login url and be redirected to https://dispatch.XXXXXXXX.XXX/default/auth/login with valid authorization header.
Configuration
Okta (dev account):

Dispatch:
DISPATCH_AUTHENTICATION_PROVIDER_SLUG: "dispatch-auth-provider-pkce”
DISPATCH_AUTHENTICATION_PROVIDER_PKCE_JWKS: "https://dev-XXXXXXXX.okta.com/oauth2/default/v1/keys"
DISPATCH_PKCE_DONT_VERIFY_AT_HASH: "true"
DISPATCH_JWT_AUDIENCE: "
VUE_APP_DISPATCH_AUTHENTICATION_PROVIDER_SLUG: dispatch-auth-provider-pkce
VUE_APP_DISPATCH_AUTHENTICATION_PROVIDER_PKCE_OPEN_ID_CONNECT_URL: "https://dev-XXXXXXXX.okta.com/oauth2/default/.well-known/openid-configuration"
VUE_APP_DISPATCH_AUTHENTICATION_PROVIDER_PKCE_CLIENT_ID: "
Client:
- Browser: chrome
- Version 92.0.4515.159, others
Additional context This is being configured against an Okta dev account. Before switching to Okta, Dispatch was working with built-in auth.
We have tried toggling DISPATCH_PKCE_DONT_VERIFY_AT_HASH and VUE_APP_DISPATCH_AUTHENTICATION_PROVIDER_USE_ID_TOKEN and did not observe any difference in behavior.
Can you try setting:
VUE_APP_DISPATCH_AUTHENTICATION_PROVIDER_SLUG=dispatch-auth-provider-pkce this will need to be set when you build the javascript bundle.
It looks like this isn't in the documentation anymore, sorry about that.
For local dev we automatically set DISPATCH_AUTHENTICATION_PROVIDER_SLUG to VUE_APP_DISPATCH_AUTHENTICATION_PROVIDER_SLUG such that the values always match. But when you go to deploy we aren't able to inject those vars.
@kevgliss Thanks for the reply. I rebuilt the docker image with the var and redeployed but unfortunately I am still seeing the same behavior. I did confirm the env vars are being set correctly within the docker container.
Hmm, I still think it's probably an issue with those variables somehow. My reasoning is that the basic auth provider is the only provider that would redirect you to /login when a request responds with a 401.
See: https://github.com/Netflix/dispatch/blob/master/src/dispatch/static/dispatch/src/api.js#L53 and https://github.com/Netflix/dispatch/blob/master/src/dispatch/static/dispatch/src/auth/basicAuthProvider.js#L11
If you are able, I would double-check which auth provider is being set at build time by adding:
console.log(authProviderSlug) here ->
https://github.com/Netflix/dispatch/blob/master/src/dispatch/static/dispatch/src/api.js#L12
Hey @kevgliss this was indeed our issue. Our environment variables weren't available at runtime like we thought they were. Passing in the VUE_APP vars as build-args to docker did the trick.
Thanks for following up @brianlwatson. I'm glad you got it working, if you're ever inclined, it would be great if you could add okta-specific setup instructions to our docs. We get a lot of questions that I'm only partially able to help with (we don't use okta).
@brianlwatson @kevgliss I could able to integrate using above steps, when I open url its redirecting to okta , once I have enter credentials it logged in, but its showing blank page always
I have added below env varibales in my .env file
DISPATCH_AUTHENTICATION_PROVIDER_SLUG=dispatch-auth-provider-pkce DISPATCH_JWT_AUDIENCE=0oaxxxxxxxx DISPATCH_PKCE_DONT_VERIFY_AT_HASH=true DISPATCH_AUTHENTICATION_PROVIDER_PKCE_JWKS=https://trial-2372xxx.okta.com/oauth2/v1/keys VUE_APP_DISPATCH_AUTHENTICATION_PROVIDER_SLUG=dispatch-auth-provider-pkce VUE_APP_DISPATCH_OPEN_ID_CONNECT_URL=trial-237xxx.okta.com VUE_APP_DISPATCH_CLIENT_ID=0oaxxxxxxx VUE_APP_DISPATCH_AUTHENTICATION_PROVIDER_PKCE_CLIENT_ID=0oa2rprxxxxxxxxxxx VUE_APP_DISPATCH_AUTHENTICATION_PROVIDER_PKCE_OPEN_ID_CONNECT_URL=https://trial-237xxxx.okta.com VUE_APP_DISPATCH_AUTHENTICATION_PROVIDER_USE_ID_TOKEN=true DISPATCH_UI_URL=http://34.68.139.77:8000/ DISPATCH_JWT_EMAIL_OVERRIDE=0oa2rprxxxxxx

here is the logs

can you please help me, what I did wrong ? & where should we give permission to users since its not local users. ex: [email protected] should get admin access to default project, [email protected] should get read access to default organization & project ? How can we achieve this

@brianlwatson ^^
Are you building from the latest release or from the master branch?
@kevgliss Im building from latest release
I used v20220915 (sep - release) , now I could see there is new version released, let me try and let you know
Thanks @kevgliss for ur help, finally after a lot of issue I could able to integrate okta in dispatch, here Im sharing steps, might be useful who are integrating okta
- Goto Okta Admin console -> Applications -> create app as showed below

DISPATCH_AUTHENTICATION_PROVIDER_SLUG=dispatch-auth-provider-pkce
DISPATCH_JWT_AUDIENCE=0oa3ewdflyStCYXZY6
DISPATCH_PKCE_DONT_VERIFY_AT_HASH=true
DISPATCH_AUTHENTICATION_PROVIDER_PKCE_JWKS=https://trial-16799.okta.com/oauth2/v1/keys
DISPATCH_AUTHENTICATION_PROVIDER_PKCE_CLIENT_ID=0oa3ewdflyStCYXZY6
VUE_APP_DISPATCH_AUTHENTICATION_PROVIDER_SLUG=dispatch-auth-provider-pkce
VUE_APP_DISPATCH_OPEN_ID_CONNECT_URL=https://trial-16799.okta.com
DISPATCH_AUTHENTICATION_PROVIDER_PKCE_OPEN_ID_CONNECT_URL=https://trial-16799.okta.com
VUE_APP_DISPATCH_CLIENT_ID=0oa3ewdflyStCYXZY6
VUE_APP_DISPATCH_AUTHENTICATION_PROVIDER_PKCE_CLIENT_ID=0oa3ewdflyStCYXZY6
VUE_APP_DISPATCH_AUTHENTICATION_PROVIDER_PKCE_OPEN_ID_CONNECT_URL=https://trial-16799.okta.com
VUE_APP_DISPATCH_AUTHENTICATION_PROVIDER_USE_ID_TOKEN=true
DISPATCH_AUTHENTICATION_PROVIDER_USE_ID_TOKEN=true
DISPATCH_UI_URL=http://34.134.20.20:8000/
as of now I couldnt able to access with http, so I have installed nginx , reverse proxy https to http, then I could able to redirect to okta, when I enter the https://ip

still facing 2 issue:
- http is not working,
- logout is not working, once I login into the dispatch application if I click on logout it still redirecting and giving the same incident dashboard, no way to logout from application ..
will let u know if I get someway
This issue is stale, because it has been open for 30 days with no activity. Remove the stale label or comment, or this will be closed in 5 days.
This issue was closed, because it has been stalled for 5 days with no activity.