Skip to content

sdk error: login function fails #109

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
sabawoon-baryal opened this issue Mar 9, 2019 · 4 comments
Closed

sdk error: login function fails #109

sabawoon-baryal opened this issue Mar 9, 2019 · 4 comments

Comments

@sabawoon-baryal
Copy link

sabawoon-baryal commented Mar 9, 2019

login function generate Url without port number. because of that the login attempt fails

here is the sdk code:

`Future login() async {
try {
Uri tempUri = Uri.parse(_client.data.serverUrl);

  Uri url = Uri(
      scheme: tempUri.scheme,
      host: tempUri.host,
      path: "${tempUri.path}$keyEndPointLogin",
      queryParameters: {
        keyVarUsername: username,
        keyVarPassword: password
      });

  final Response response = await _client.get(url, headers: {
    keyHeaderRevocableSession: "1",
  });

  print(url);

  return _handleResponse(
      this, response, ParseApiRQ.login, _debug, className);
} on Exception catch (e) {
  return _handleException(e, ParseApiRQ.login, _debug, className);
}

}`

here is the refactored code:
`Future login() async {
try {
Uri tempUri = Uri.parse(_client.data.serverUrl);

  Uri url = Uri(
      scheme: tempUri.scheme,
      host: tempUri.host,
      port: tempUri.port,
      path: "${tempUri.path}$keyEndPointLogin",
      queryParameters: {
        keyVarUsername: username,
        keyVarPassword: password
      });

  final Response response = await _client.get(url, headers: {
    keyHeaderRevocableSession: "1",
  });

  print(url);

  return _handleResponse(
      this, response, ParseApiRQ.login, _debug, className);
} on Exception catch (e) {
  return _handleException(e, ParseApiRQ.login, _debug, className);
}

}`

add port: tempUri.port to parse_server_sdk-1.0.15/lib/src/objects/parse_user.dart [160]

@phillwiggins
Copy link
Member

Will add in the next release. Thanks for pointing this out.

@phillwiggins
Copy link
Member

This has been fixed in 1.0.16. This is currently waiting to be released but will be done shortly.

@sabawoon-baryal
Copy link
Author

the same problem is in query() method of QueryBuilder class, thanks

@phillwiggins
Copy link
Member

phillwiggins commented Mar 19, 2019 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants