10000 🐛 Bug Report: "Invalid `success` param: URL host must be one of ... · Issue #7255 · appwrite/appwrite · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

🐛 Bug Report: "Invalid success param: URL host must be one of ... #7255

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

Closed
2 tasks done
erdkse opened this issue Dec 7, 2023 · 11 comments
Closed
2 tasks done

🐛 Bug Report: "Invalid success param: URL host must be one of ... #7255

erdkse opened this issue Dec 7, 2023 · 11 comments
Assignees
Labels
bug Something isn't working product / auth Fixes and upgrades for the Appwrite Auth / Users / Teams services.

Comments

@erdkse
Copy link
erdkse commented Dec 7, 2023

👟 Reproduction steps

I am a self-hosted user. I installed appwrite with domain 'A' and created an application and added another domain 'B' as custom domain to project to support OAuth login.

When I try to login via Google I receive this error.

Screenshot 2023-12-07 at 11 27 54

I configured SDK platform hostname correctly and I am sending right redirect urls on success and fail cases when logging in.

👍 Expected behavior

It should succesfully login.

👎 Actual Behavior

It throws an error for misconfiguration.

🎲 Appwrite version

Version 1.4.x

💻 Operating system

Linux

🧱 Your Environment

I use Appwrite v1.4.9 on docker-compose. There is no customization.

I am using Web SDK v13.0.1

👀 Have you spent some time to check if this issue has been raised before?

  • I checked and didn't find similar issue

🏢 Have you read the Code of Conduct?

@erdkse erdkse added the bug Something isn't working label Dec 7, 2023
@stnguyen90
Copy link
Contributor

@erdkse, thanks for creating this issue! 🙏 Have you created a web platform with the same hostname as the success url you're trying?

8000

@stnguyen90 stnguyen90 self-assigned this Dec 8, 2023
@stnguyen90 stnguyen90 added the product / auth Fixes and upgrades for the Appwrite Auth / Users / Teams services. label Dec 8, 2023
@erdkse
Copy link
Author
erdkse commented Dec 8, 2023

Yes @stnguyen90, email session work well on my actual domain, but there is another issue with the hostname, If I add only the domain I am not able to create an email session too, I have to add hostname with wildcard as *.B.

To summarize again;

  1. I installed appwrite instance to appwrite.A domain
  2. I created a project and added a custom domain appwrite.B.
  3. I configured my Web platform hostname as *.B.
  4. I am interacting to appwrite instance pointing appwrite.B by Web SDK.
  5. My web application is getting served directly from domain B.

And the error message says that. The success URL must be one of localhost, appwrite.B, *.B.

If I change Web platform hostname to B. Error message changes as localhost, appwrite.B, B. But this time creating email session throws CORS error.

Screenshot 2023-12-08 at 19 47 53

It looks like my Request Headers' origin and the rest are correct when I send request from domain B but I receive this Response Headers.

Screenshot 2023-12-08 at 19 51 35

Note: There is no issue when creating OAuth or Email session on localhost.

@optionedge
Copy link

I also facing exact same issue. My hosting and usage environment is similar to above. I am also getting the following message:

Invalid `success` param: URL host must be one of: localhost, auth.mydomain.in, *

Type

general_argument_invalid

@stnguyen90
Copy link
Contributor
stnguyen90 commented Dec 11, 2023

@erdkse, thanks for the details. It should work if you put an exact match for the domain your app is running on and the web platform. For example, if my app is running on app.example.com, I would put app.example.com as the web platform. In addition, my success url for the create OAuth2 session API call would be something like https://app.example.com.

If I change Web platform hostname to B. Error message changes as localhost, appwrite.B, B. But this time creating email session throws CORS error.

Can you share request logs for the create email session API call? Maybe something else caused it to fail.

Btw, there is a problem in which wildcards are not honored when validating URLs in params like the success URL. That issue is here: #6322 (comment).

@stnguyen90
Copy link
Contributor

@optionedge, are you still seeing the error? FYI, I'll need to close this due to inactivity soon.

@erdkse
Copy link
Author
erdkse commented Dec 20, 2023

Sorry @stnguyen90, I have some unexpected things to do so I am not able to share logs for the next 2-3 days. Yes, I am still having the issue but I was able to solve the problem for both login methods by adding www in front of my hostname.

I will share the logs as soon as I find the chance.

@optionedge
Copy link

@stnguyen90 If I put exact domain, in web platform and put the same in success url for oauth then it works, however then email login stopped working because of cors issue:

This is my current scenario:

  1. Email Registration and Login
    I have authentication hosted on auth.website.in (appwrite), my landing/login page is on website.in. When I put exact domain name in web platform I got cors issue:

Access to XMLHttpRequest at 'https://auth.mywebsite.in/v1/account/sessions/email' from origin 'https://mywebsite.in' has been blocked by CORS policy: The 'Access-Control-Allow-Origin' header has a value 'https://localhost' that is not equal to the supplied origin.

As soon as I change the host on web platform to '*' email login works properly, then it breaks the oAuth.

  1. oAuth Login
    As explained above, oauth works when put exact domain in web platform host, but it breaks the email login. I am distributing software that can be installed at clients end as web application. When oau 8000 th is successful, I am redirecting to localhost (localhost in success url). Appwrites check for exact domain name (not wildcard, stopping me to use oAuth).

I have currently disabled the oauth and using only email auth. Not sure how to get around the above issue.

@stnguyen90
Copy link
Contributor
stnguyen90 commented Jan 2, 2024

@erdkse, did you add an additional web platform for your site? Seeing as you have 2 websites accessing your Appwrite project, you should have 2 web platforms with the matching hostname.

@erdkse
Copy link
Author
erdkse commented Jan 5, 2024

hey @stnguyen90, no I have only 1 platform to reach the project, the other hostname is responsible for reaching to appwrite in general or to the other projects inside appwrite. But I solved my problem only by adding "www" in front of my hostname. Now I am able to handle both email and OAuth authentication without any issue.

@VTFLAB
Copy link
VTFLAB commented Jan 7, 2024

hey, I am also experiencing a similar issue; it does not work in the development debug mode (localhost). Is it not possible to set localhost as the redirect destination? The error message seems to suggest that localhost is allowed.

image

The web application is running locally, and Appwrite is operating on a separate server under a global domain. As shown in the image, I have already added it to the platform, and there are no CORS issues.

@VTFLAB
Copy link
VTFLAB commented Jan 7, 2024

hey, I am also experiencing a similar issue; it does not work in the development debug mode (localhost). Is it not possible to set localhost as the redirect destination? The error message seems to suggest that localhost is allowed.

image

The web application is running locally, and Appwrite is operating on a separate server under a global domain. As shown in the image, I have already added it to the platform, and there are no CORS issues.

Ah, I've resolved it myself. It seems that the address specified in the successURL must end with a slash.

@stnguyen90 stnguyen90 closed this as not planned Won't fix, can't repro, duplicate, stale Feb 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working product / auth Fixes and upgrades for the Appwrite Auth / Users / Teams services.
Projects
None yet
Development

No branches or pull requests

4 participants
0