github oauth always throwing error when used with organisation option enabled

Hey all, need a bit of help here because I'm out of all options now. I'm trying to set up GitHub for user authentication following this guide: https://coder.com/docs/admin/users/github-auth What I did was: - Created a GitHub App for my organisation - Used the client ID & Secret to set coder's environment variables. Here's what my env looks like:
CODER_PORT=tcp://**.**.**.**:80
KUBERNETES_SERVICE_PORT_HTTPS=443
CODER_OAUTH2_GITHUB_CLIENT_SECRET=***
KUBERNETES_SERVICE_PORT=443
KUBE_POD_IP=**.**.**.**
CODER_DERP_SERVER_RELAY_URL=http://*.*.*.*:8080
CODER_ACCESS_URL=https://coder.example.com
HOSTNAME=coder-66c8d6f7f6-nd8qn
CODER_PORT_80_TCP_PORT=80
CODER_PORT_80_TCP_PROTO=tcp
CODER_OAUTH2_GITHUB_DEVICE_FLOW=false
PWD=/home/coder
CODER_PROMETHEUS_ADDRESS=0.0.0.0:2112
CODER_OAUTH2_GITHUB_ALLOWED_ORGS="My-Organisation"
CODER_SERVICE_PORT_HTTP=80
CODER_WILDCARD_ACCESS_URL=https://*.coder.example.com
HOME=/home/coder
KUBERNETES_PORT_443_TCP=tcp://**.**.**.**:443
CODER_SERVICE_PORT=80
CODER_SERVICE_HOST=*.*.*.*
TERM=xterm
CODER_HTTP_ADDRESS=**.**.**.**:8080
CODER_OAUTH2_GITHUB_CLIENT_ID=***
SHLVL=2
KUBERNETES_PORT_443_TCP_PROTO=tcp
KUBERNETES_PORT_443_TCP_ADDR=**.**.**.**
CODER_PORT_80_TCP_ADDR=**.**.**.**
CODER_OAUTH2_GITHUB_ALLOW_SIGNUPS=true
_=/usr/bin/env
CODER_PORT=tcp://**.**.**.**:80
KUBERNETES_SERVICE_PORT_HTTPS=443
CODER_OAUTH2_GITHUB_CLIENT_SECRET=***
KUBERNETES_SERVICE_PORT=443
KUBE_POD_IP=**.**.**.**
CODER_DERP_SERVER_RELAY_URL=http://*.*.*.*:8080
CODER_ACCESS_URL=https://coder.example.com
HOSTNAME=coder-66c8d6f7f6-nd8qn
CODER_PORT_80_TCP_PORT=80
CODER_PORT_80_TCP_PROTO=tcp
CODER_OAUTH2_GITHUB_DEVICE_FLOW=false
PWD=/home/coder
CODER_PROMETHEUS_ADDRESS=0.0.0.0:2112
CODER_OAUTH2_GITHUB_ALLOWED_ORGS="My-Organisation"
CODER_SERVICE_PORT_HTTP=80
CODER_WILDCARD_ACCESS_URL=https://*.coder.example.com
HOME=/home/coder
KUBERNETES_PORT_443_TCP=tcp://**.**.**.**:443
CODER_SERVICE_PORT=80
CODER_SERVICE_HOST=*.*.*.*
TERM=xterm
CODER_HTTP_ADDRESS=**.**.**.**:8080
CODER_OAUTH2_GITHUB_CLIENT_ID=***
SHLVL=2
KUBERNETES_PORT_443_TCP_PROTO=tcp
KUBERNETES_PORT_443_TCP_ADDR=**.**.**.**
CODER_PORT_80_TCP_ADDR=**.**.**.**
CODER_OAUTH2_GITHUB_ALLOW_SIGNUPS=true
_=/usr/bin/env
Now, when I try to login, this is what I get: You aren't a member of the authorized GitHub organizations! I've double-checked I'm a member as well as owner of the github organisation. I'm not sure if there's something I'm doing wrong or this is some sort of bug. Coder version is: v2.21.0 Any response would be appreciated.
GitHub OAuth Setup Guide | Coder Docs
Set up GitHub OAuth for Coder, enabling GitHub and GitHub Enterprise authentication with OAuth app configuration and Helm deployment steps.
From An unknown user
From An unknown user
10 Replies
Codercord
Codercord2w ago
<#1359758339604484310>
Category
Help needed
Product
Coder (v2)
Platform
Linux
Logs
Please post any relevant logs/error messages.
uv.panta
uv.pantaOP7d ago
Hey @Phorcys , can you please help me out on this one? 🙏
Phorcys
Phorcys7d ago
taking a look in a sec @uv.panta does it work if you undefine CODER_OAUTH2_GITHUB_ALLOWED_ORGS?
Phorcys
Phorcys7d ago
on another note, have you granted access to that org when logging in?
No description
uv.panta
uv.pantaOP7d ago
Yes, it works when I undefine CODER_OAUTH2_GITHUB_ALLOWED_ORGS. And yes, granted access to the org. Thanks @Phorcys
Phorcys
Phorcys7d ago
alright set CODER_VERBOSE=true and look at the logs when logging in
uv.panta
uv.pantaOP7d ago
Ahh okay, let me try that.
Phorcys
Phorcys7d ago
it'll allow you to see the data from the OIDC claims and hopefully help you figure out what's wrong look for "got oidc claims" https://coder.com/docs/admin/users/oidc-auth#oidc-claims
uv.panta
uv.pantaOP6d ago
Hey @Phorcys sorry for the delay. I do not get organizations & teams option when I try to authenticate. This is what my auth screen from github looks like. Is there any sepcific permission I need to enable in Github?
No description
uv.panta
uv.pantaOP5d ago
All good. TIL I need to install the app to the organisation (not just creating it) 😬

Did you find this page helpful?