Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

discord auth #19224

Closed
BlackDahlia313 opened this issue Jul 24, 2023 · 11 comments
Closed

discord auth #19224

BlackDahlia313 opened this issue Jul 24, 2023 · 11 comments

Comments

@BlackDahlia313
Copy link
Contributor

BlackDahlia313 commented Jul 24, 2023

Describe the Bug

When trying to add discord as a SSO provider, deployment fails and asks for the client id, even tho one is specified.

Has anyone else seen this?

To Reproduce

Add discord as a sso provider and try to deploy

Directus Version

v10.4.3

Hosting Strategy

Self-Hosted (Docker Image)

AUTH_DISCORD_DRIVER=oauth2

AUTH_DISCORD_CLIENT_ID=****

AUTH_DISCORD_CLIENT_SECRET=****

AUTH_DISCORD_AUTHORIZE_URL=https://discord.com/oauth2/authorize

AUTH_DISCORD_ACCESS_URL=https://discord.com/api/oauth2/token

AUTH_DISCORD_PROFILE_URL=https://discord.com/api/users/@me

AUTH_DISCORD_ALLOW_PUBLIC_REGISTRATION=true

AUTH_DISCORD_DEFAULT_ROLE_ID=*****

AUTH_DISCORD_ICON=discord

AUTH_DISCORD_LABEL=Discord

AUTH_DISCORD_EMAIL_KEY=email

AUTH_DISCORD_IDENTIFIER_KEY=email
@rijkvanzanten
Copy link
Member

When I copy paste those exact environment variables (even with *** instead of values) Directus seems to deploy on my end. How are you setting those environment variables? Could it be that some of the secrets aren't making it to the Directus environment properly?

This is most likely a deployment related issue rather than a bug in Directus 🤔

@BlackDahlia313
Copy link
Contributor Author

BlackDahlia313 commented Jul 24, 2023

It’s really weird @rijkvanzanten

I add that above like any other ENV and during finally deployment checks it fails and asks for client id.

(This will fail a DO deployment)

Been doing this for me since I started with directus.

Only when I add discord.

If I change it to openid I get a different error. So it’s def reading it.

But if I change it back to oauth than it fails again asking for a client id that is def supplied.

I’m wondering if it doesn’t like the client id for some reason?

Every other provider I throw doesn’t do this haha.

Let me try creating a new discord app and getting fresh client id. And check.

It does build fine. But DO won’t deploy it because it keeps asking for client id.

Idk lol

@BlackDahlia313
Copy link
Contributor Author

This is most likely a deployment related issue rather than a bug in Directus 🤔

It’s really weird @rijkvanzanten

Let me try creating a new discord app and getting fresh client id. And check.

It does build fine. But DO won’t deploy it because it keeps asking for client id.

Idk lol

So I deleted the old disord app and created a new one with new keys. Same issue.

This is what I see.

image

As soon as I add discord to the list of auths,

AUTH_PROVIDERS=github,twitch,discord

than I get the above error and the deployment fails.

If I remove discord from the provider list and leave the rest of the above, it deploys fine (obviously as its not trying to add it as a provider)

@rijkvanzanten
Copy link
Member

@BlackDahlia313 Can you try it with just discord and nothing else? 🤔

@BlackDahlia313
Copy link
Contributor Author

@BlackDahlia313 Can you try it with just discord and nothing else? 🤔

checking meow

@BlackDahlia313
Copy link
Contributor Author

BlackDahlia313 commented Jul 24, 2023

@BlackDahlia313 Can you try it with just discord and nothing else? 🤔

just having discord there throws same thing. It just does not like discord it seems lol. I could try a fresh demo on railway instead of DO and test to see if it does the same thing.

image
image

@BlackDahlia313
Copy link
Contributor Author

@rijkvanzanten

image

Confirmed it on a fresh demo railway deployment too.

image

@rijkvanzanten
Copy link
Member

Very odd. Is there a chance that you have the same environment variable twice? Does it work when you rename it to something else (eg dahlia instead of discord). That is a generic error that'd be the same regardless of provider, so if it works for twitch, it should work for Discord 🤔

(In any case, I'll close this for now as it's most likely a configuration issue rather than a bug in Directus. Happy to reopen if it turns out to be otherwise)

@rijkvanzanten rijkvanzanten closed this as not planned Won't fix, can't repro, duplicate, stale Jul 24, 2023
@BlackDahlia313
Copy link
Contributor Author

BlackDahlia313 commented Jul 24, 2023

@rijkvanzanten

I didnt see this originally when searching. So my apologizes. We should maybe put a small callout in the sso docs that specifically calls out discord. (kinda like how theres one about github and emails)

#11956 (comment)

#11956

All is good now. But it is discord itself. so strange.

Now the question is. should I leave it as dahlia or flip it back to discord lol xD

image

@rijkvanzanten
Copy link
Member

rijkvanzanten commented Jul 24, 2023

Ahhhhhhh yes I now see it too! In my testing before, I had regular characters in the client_id to test if it was the variable not making it to the setting. That makes a ton of sense, as discord only uses numbers. Another point to implement #9521 sometime soon..

@BlackDahlia313
Copy link
Contributor Author

Ahhhhhhh yes I now see it too! In my testing before, I had regular characters in the client_id to test if it was the variable not making it to the setting. That makes a ton of sense, as discord only uses numbers. Another point to implement #9521 sometime soon..

I knew I wasn't crazy! hahaha

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 1, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
Archived in project
Development

No branches or pull requests

2 participants