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
- Different appwrite IDs are getting expos...
File_URL_FORMAT= https://cloud.appwrite.io/v1/storage/buckets/[BUCKET_ID]/files/[FILE_ID]/preview?project=[PROJECT_ID] I'm trying to access files in my web app...
- Invalid document structure: missing requ...
I just pick up my code that's working a week ago, and now I got this error: ``` code: 400, type: 'document_invalid_structure', response: { message: 'Inv...
- custom domain with CloudFlare
Hi all, it seems that CloudFlare has blocked cross-domain CNAME link which made my app hostname which is in CloudFlare, unable to create a CNAME pointing to clo...