Closed whoacowboy closed 1 year ago
If I write it as a string in my options object, it works as expected.
export default async ({ app }) => {
const options = {
providers: {
discord: {
clientId: '*****************77',
redirectUri: process.env.DISCORD_REDIRECT_URL,
}
}
const Oauth = new UniversalSocialauth(axios, options)
app.config.globalProperties.$Oauth = Oauth
app.provide('$Oauth', Oauth)
}
can you submit the PR for the codepen patch
Once I get it working I will.
It looks like it might be an issue with dotenv
converting the string to a number.
The number is too large for JS so it rounds it up or down.
Once I figure it out I'll let you know.
It was my dotenv configuration.
Describe the bug When creating a Discord social login, universal-social-auth will cut off the last two digital of my Discord clientId which ends with 77 but it replaces them with zeros. If I replace the last two zeros in the URI with 77, everything works. Is there a setting for clientId length that I am missing?
https://discord.com/oauth2/authorize?response_type=code&client_id=*****************00&redirect_uri=https://my.site:8080/auth/discord/callback&scope=identify%20email
I did a little bit of investigation and it looks like this issue has to do with Discord using a completely numeric clientId.
This piece of code seems to be the issue.
https://github.com/diadal/universal-social-auth/blob/e637bc63577c93307907ca5d904d08b451311ec3/src/utils.ts#L67-L80
I made this codepen that demonstrates the issue.
https://codepen.io/whoacowboy/pen/VwVrBpr
I think it has to do with the the number being larger than JavaScipt can handle as an integer.
https://stackoverflow.com/questions/4557509/javascript-summing-large-integers
I tried wrapping the clientId in quotes and that did not fix the issue.