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
- MFA Recovery Codes issue
after creating recovery codes using `account.createMFARecoveryCodes()` do we need to Verify MFA factors type recovery code? I followed this guide: https://appw...
- Build Error Truncated
I'm trying to start with Appwrite using an existing Next.js project of mine. When a deployment runs though it just ends up showing :`server error.","code":500,"...
- Github repositories not showing on avail...
Hi there, I installed appwrite to be connected to a specific respository but when selecting to deploy form git on the site building, there is no repositories ap...