When I cancel the oauth of discord it returns with get Param "code" is not optional
I think this is a known issue. You might want to 👍 this issue: https://github.com/appwrite/appwrite/issues/2591
alr
<a:happi:1107928866477064202>
[CLOSED] ERROR: get Param "code" is not optional.
Sadly still not fixed...
ERROR: get Param "code" is not optional.
Do you know when it will be? because that issue has been arround for like a year
Are you using self-hosted version of Appwrite or the cloud?
Are you able to share what provider you're using and the full url of the page?
Selfhosted running V3.7
Then you can try this
Creating small Override
For all the instructions I'll assume your docker-compose.yml is located in your /root/appwrite folder
Edit docker compose
Edit your docker compose file and bind account.php like so
appwrite:
image: appwrite/appwrite:1.3.7
container_name: appwrite
<<: *x-logging
restart: unless-stopped
networks:
- appwrite
labels:
...
volumes:
...
- /root/customized/account.php:/usr/src/code/src/app/controllers/api/account.php
depends_on:
...
environment:
...
Create alternative account.php file
Create a folder in your root directory named it customized and within it create file name account.php
paste this alternative account.php file.
https://gist.github.com/byawitz/dadc21d94a36ea51b1bc3ad62cd946b8
The differences are in rows 323-384, in which I've set the code to be optional
->param('code', '', new Text(2048), 'OAuth2 code.', true)
Setting code as optional will already solve half of the problem. to solve to other half there's another few things to do
Then added optional failure parameter.
->param('failure', '', new Text(2048), 'Failure URL.', true)
And add it as parameter to the function.
->action(function (..., string $code, string $failure, ...)
And within the code I've checked to see if no code provided then the user will redirect to the failure URL.
if(empty($code)) {
$response->redirect($failure, 301);
return;
}
I haven't tried it yet. But, it should work.
Try it out and let us know.
And if you use coolify?
im pretty sure the docker-compose file is somewhere, right?
Mmm, your Appwrite is behinds Coolify. I haven't used it recently.
But from the script I see they running the docker-compose should be located in the home directory
Search for it in Appwrite server
find / -name "docker-compose.yml"
Are you able to share what provider you're using and the full url of the page?
Did it worked?
I haven't looked into it since yesterday
Recommended threads
- Endless certificate generation cycle
Hello, when I try to add the subdomain stats.hedgehog-rp.ru, I get an infinite loop while the certificate is being generated. There are no problems with adding ...
- Realtime not working for some tables
Hi, I've got an issue where I can setup a realtime connection to listen to some tables, but some not all. I have two tables `history` and `users`. Both can be ...
- How to handle ghost accounts created by ...
Appwrite create the account with the email and send an invitation link with a secret. I am able to accept the invitation and add the account as a member on the ...