Skip to content
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

[bug] - all login params are required #11

Closed
mgkimsal opened this issue Sep 8, 2019 · 3 comments
Closed

[bug] - all login params are required #11

mgkimsal opened this issue Sep 8, 2019 · 3 comments
Assignees
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@mgkimsal
Copy link

mgkimsal commented Sep 8, 2019

Calling from JS aw.auth.login(this.username, this.password);

yields back

{"message":"Invalid success: URL host must be one of: https://appwrite.io, https://appwrite.test, http://appwrite.test, https://localhost, http://localhost, http://localhost/v1","code":400,"file":"/usr/share/nginx/html/vendor/utopia-php/framework/src/App.php","line":456,"trace":[{"file":"/usr/share/nginx/html/vendor/utopia-php/framework/src/App.php","line":395,"function":"validate","class":"Utopia\App","type":"->","args":["success",{"default":null,"validator":{},"description":"URL to redirect back to your app after a successful login attempt.","optional":true,"value":null},"null"]},{"file":"/usr/share/nginx/html/app/app.php","line":793,"function":"run","class":"Utopia\App","type":"->","args":[{},{}]},{"file":"/usr/share/nginx/html/public/index.php","line":27,"args":["/usr/share/nginx/html/app/app.php"],"function":"include"}],"version":"latest"}

The 'success' and 'failure' URLs are still required by the backend.

This might be related to
utopia-php/http@5ac8c91#diff-58980ac23a3a9a0b92abd9805eed1e78

in Utopia forcing default values? It's a bit hard to follow as I'm not sure what 'param' method is doing here:

->param('success', null, function () use ($clients) {return new Host($clients);}, 'Redirect when registration succeed', true)

Is param() call creating/invoking a validator directly?

The docs/examples are somewhat out of sync as well, as docs show

appwrite.users.login()

but it should be

appwrite.auth.login()

@mgkimsal mgkimsal changed the title [bug] - login params are required [bug] - all login params are required Sep 9, 2019
@eldadfux eldadfux added the bug Something isn't working label Sep 9, 2019
@eldadfux eldadfux self-assigned this Sep 9, 2019
@eldadfux
Copy link
Member

eldadfux commented Sep 9, 2019

Yes, actually we had to change the original implementation after browsers started blocking 3rd party cookies that we were using for sessions. I guess the code examples got out of sync, I will make sure to fix it.

I will have to take a deeper look at the default param issue and see how we can fix it.

@mgkimsal
Copy link
Author

mgkimsal commented Sep 9, 2019

Thanks. I may try to dig on this this evening or tomorrow.

To clarify @eldadfux - I'm trying to call the appwrite SDK from JS, and am just trying to get back the 200 or 401 and the corresponding payload to process and move on from that login point. The payload coming back is always '400' because of these missing fields.

@eldadfux eldadfux added the help wanted Extra attention is needed label Sep 13, 2019
@eldadfux
Copy link
Member

We are trying to remove the extra params required for the login and register methods in this issue: #268, Hopefully this will work for modern browsers and we'll only use the extra params as fallback for older ones.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants