Code Monkey home page Code Monkey logo

parse-sdk-flutter's People

Contributors

bernhardfrenking avatar chrbayer avatar danaru87 avatar fischerscode avatar gcostaapps avatar hellokidder avatar hyperrecursive avatar ionagorria avatar klanmiko avatar manhhavu avatar mbfakourii avatar mtrezza avatar nidal-bakir avatar nstrelow avatar pastordee avatar pcg92 avatar phillwiggins avatar piotrwpl avatar rickspencer3 avatar rodrigosmarques avatar rostopira avatar saifallak avatar seasonsolution avatar tomwfox avatar vigneshpasupathy avatar wahdanz avatar wangperrywpy avatar yulingtianxia avatar zenz avatar zhangwb1996 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

parse-sdk-flutter's Issues

[ParseCloudFunction] Unhandled exception: type 'ParseObject' is not a subtype of type 'DietPlan' in type cast

Hello,

I created a Cloud Code Function which returns only one Diet_Plans object.

I execute this code :

function() async {
    var function = ParseCloudFunction('getOneDietPlan');
    var response = await function.execute();

    if (response.success) {
      print(ApplicationConstants.APP_NAME + ": " + (response.result as DietPlan).name);
    } else {
      print(ApplicationConstants.APP_NAME + ": " + response.error.message);
    }
  }

And there is an error with the print in the success condition, this is my console :

I/flutter (25760): ----
I/flutter (25760): Hello Flutter API Response (getOneDietPlan : ParseApiRQ.execute) :
I/flutter (25760): Status Code: 200
I/flutter (25760): Payload: Instance of 'ParseObject'
I/flutter (25760): ----
E/flutter (25760): [ERROR:flutter/shell/common/shell.cc(184)] Dart Error: Unhandled exception:
E/flutter (25760): type 'ParseObject' is not a subtype of type 'DietPlan' in type cast

And similar error when the cloud code function return multiple objects, there is an error like :

type 'ParseObject' is not a subtype of type 'Iterable<dynamic>' in type cast

In advance, thank you.

Increment field Example

hi all!
I am trying to test the increment option using the following code but have no luck, could anyone please indicate what I am doing wrong!
Thanks,

var apiResponse = await DietPlan()
.getObject('i1FgSlj5TJ');

if (apiResponse.success && apiResponse.result != null) {
  var dietPlan = apiResponse.result as DietPlan;
  dietPlan.increment('Carbs', 10);
  dietPlan.save();
}

How to perform relational queries with Pointers?

I have a class Customer that has a property user. That's a Pointer to User. How can I perform a query that does this where?

where={"user":{"__type":"Pointer","className":"_User","objectId":"8TOXdXf3tz"}}

Complete Parse Serverr

Hello, are all Parse Server features (Livequery, Local datastore, Query cache, cloud functions, etc..) implemented??

How to login with email?

I see that there are 2 login-related interfaces, one is login using username to log in, the other is loginWith, can loginWith log in using email? Is there an example? Thanks

Parse on Dart VM

Since there is no dependency for specific Flutter feature, why this library use Flutter SDK?
It can be more useful when this parse SDK can be used on dart vm or console app as well

Possibility to pass SecurityContext to HttpClient creation

Hi, thanks for making this lib!

To support connections to a parse server with a self-signed certificate from a mobile app, I need to pass a special created SecurityContext to the creation of the HttpClient. Are there any plans to do so?
Would it help if I prepare a PR?

Thanks in advance!

Best regards,
Chris

Does logout delete all the local user data?

I am using user.logout(). what I think is happening:

  1. Session data gets deleted from the Parse server.
  2. All of the local user data gets deleted from the shared preferences.

#1 is expected, but #2 is not. Is it possible that logout() could leave the user data in place so that I can easily log the user back in again?

Perhaps I am not understanding what is happening correctly? I am testing on an android emulator.

support angular dart

it will be useful if it supports angular dart, so is there any planning to support it.

Adding Array Data to Array Field Failing

Hi Phill,
I have modified the diet plan class and added an ingredients array field, and successfully created the object. now when testing the add function I got an parse error on response with Unexpected token s in JSON at position 43, check the code below:

void addArray() async {
var list = ["sugar", "rice", "salt"];
var apiResponse = await DietPlan().getObject('j2S0JZhbpC');
if (apiResponse.success && apiResponse.result != null) {
var dietPlan = (apiResponse.result as DietPlan);
var response = await dietPlan.add('ingredients', list);
dietPlan.save();
} else {
print('ERROR');
}
}

className doesn't come right in custom query

Hi,

This is how I'm doing the query. My custom class is called Customer:
var query = "order=name";
var response = await ParseObject('Customer').query(query);

This is the debug print as the result of the query. Notice that the className doesn't bring the correct name of the class, that was supposed to bring "Customer". It's bringing "className".

I/flutter (20753): Parse API Response (Customer : ParseApiRQ.query) :
I/flutter (20753): Status Code: 200
I/flutter (20753): Payload: [{"className":"className","objectId":"ok0nKdMvkI","createdAt":"2019-01-18T17:02:41.109Z","updatedAt":"2019-01-18T23:19:50.064Z","name":"Fulano de Tal","email":"[email protected]","phone":"3423532","active":true,"user":null}, {"className":"className","objectId":"uT0NYuGQyM","createdAt":"2019-01-18T17:03:58.910Z","updatedAt":"2019-01-18T23:19:39.620Z","name":"José Silva","email":"[email protected]","active":true,"user":null}]

Port not being mapped on HTTP request

I have several parse instances running on different ports. When trying to connect to an instance that is not on the default port, all requests fail. It appears that the port number is not being mapped into the HTTP url request. e.g in parse_user.dart login method:

      Uri url = Uri(
          scheme: tempUri.scheme,
          host: tempUri.host,
          path: "${tempUri.path}$keyEndPointLogin",
          queryParameters: {
            keyVarUsername: username,
            keyVarPassword: password
});
Amending this to pass in the port fixes the problem:-
      Uri url = Uri(
          scheme: tempUri.scheme,
          host: tempUri.host,
          **port: tempUri.port,**
          path: "${tempUri.path}$keyEndPointLogin",
          queryParameters: {
            keyVarUsername: username,
            keyVarPassword: password
});

There are several instances in the code where this will need a fix. (parse_user, parse_object etc.)

[Issue] ParseUser logout doesn't work

Hi,

The issue is simple, I signed my user in but after I logged out with "user.logout();",

when I restart my application and check my ParserUser.currentUser(), it still contains my user.

In advance, thank you.

logout and getCurrentUserFromServer give unexpected results

Pubspec :

parse_server_sdk:
    git:
      url: https://github.com/phillwiggins/flutter_parse_sdk.git
      ref: develop

var user = await ParseUser("eslamira", "eslamirapassword", null).login();

// Success login

and :

await ParseUser.currentUser();

returns

{"className":"_User","objectId":"UdMqp45eTs","createdAt":"2019-01-27T16:05:46.340Z","updatedAt":"2019-01-29T15:15:43.276Z","username":"""eslamira""","password":"""eslamirapassword""","services":null,"ACL":{"*":{"read":true},"UdMqp45eTs":{"read":true,"write":true}},"sessionToken":"""r:9c44da87b21d666881886b6a4794c039"""}

then i try

var user = await (await ParseUser.currentUser).logout();

and :

await ParseUser.currentUser();

returns the same object

{"className":"_User","objectId":"UdMqp45eTs","createdAt":"2019-01-27T16:05:46.340Z","updatedAt":"2019-01-29T15:15:43.276Z","username":"""eslamira""","password":"""eslamirapassword""","services":null,"ACL":{"*":{"read":true},"UdMqp45eTs":{"read":true,"write":true}},"sessionToken":"""r:9c44da87b21d666881886b6a4794c039"""}

so ? he didn't logout ?!

Why Master Key and not Client Key?

Hi!
I want to use this lib in my application, but I have noticed that I need to supply the master key, which I consider to be a security issue.
In Parse documentation I found this:

_" The master key, on the other hand, is definitely a security mechanism. Using the master key allows you to bypass all of your app’s security mechanisms, such as class-level permissions and ACLs. Having the master key is like having root access to your app’s servers, and you should guard your master key with the same zeal with which you would guard your production machines’ root password.

The overall philosophy is to limit the power of your clients (using client keys), and to perform any sensitive actions requiring the master key in Cloud Code."_

And here i found this:

_"However, it requires a few precautions:

Never include your master key in any binary or source code you ship to customers;
Only use master key in the server side code;
Never give your master key to untrusted people."_

I tried to use the client key instead of the master, but I received "unauthorized access".
Can this library be modified to work with the client key rather than the master key?
Thank you!

Problem with parseEncode function in version 1.0.14

After update to version 1.0.14 I have problem with parseEncode function.

The function abort execution with message ""Failed assertion: boolean expression must not be null""

captura de tela 2019-03-07 as 00 41 00

The problem occurs in Login, apiResponse.result from Query and others cases.

I try return to version 1.0.13, same with parse_server_sdk: ^1.0.13 in pubspec.yaml, the install version is 1.0.14

currentUser doesn't get updated even after calling getUserFromServer

ParseUser.currentUser(); once called the currentUser i get doesn't get updated again for example i update the user's values and save them to the database and when i cal getUserfromServer it get the values right but doesn't show in currentUser unless i completely remove the cache data like remove the app from the phone and then the updated data is in the currentUser but again it doesn't update at all

these are the log from the normal run i added some values to user saved it and it does show for the getUserFromServer but not for the local currentUser (the one with minus sign in it is the currentUser)

{"className":"_User","objectId":"UdMqp45eTs","createdAt":"2019-01-27T16:05:46.340Z","updatedAt":"2019-01-31T22:39:36.045Z","username":"+201144753259","secondarySubscription":"{"__type": "Pointer", "className": "Subscription", "objectId": "xxxxxxxxxxx"}","primarySubscription":"{"__type": "Pointer", "className": "Subscription", "objectId": "fffffffff"}","services":null,"ACL":{"":{"read":true},"UdMqp45eTs":{"read":true,"write":true}},"sessionToken":"r:46a7f17dd2aa364909530241a7bc5c94"}
--------------{"className":"_User","objectId":"UdMqp45eTs","createdAt":"2019-01-27T16:05:46.340Z","updatedAt":"2019-01-31T22:39:36.045Z","username":"+201144753259","password":"+201144753259","services":null,"ACL":{"
":{"read":true},"UdMqp45eTs":{"read":true,"write":true}},"sessionToken":"r:46a7f17dd2aa364909530241a7bc5c94"}

and these are the logs after removing the cache => now i'm getting it right

{"className":"_User","objectId":"UdMqp45eTs","createdAt":"2019-01-27T16:05:46.340Z","updatedAt":"2019-01-31T22:39:36.045Z","username":"+201144753259","secondarySubscription":"{"__type": "Pointer", "className": "Subscription", "objectId": "xxxxxxxxxxx"}","primarySubscription":"{"__type": "Pointer", "className": "Subscription", "objectId": "fffffffff"}","services":null,"ACL":{"":{"read":true},"UdMqp45eTs":{"read":true,"write":true}},"sessionToken":"r:46a7f17dd2aa364909530241a7bc5c94"}
--------------{"className":"_User","objectId":"UdMqp45eTs","createdAt":"2019-01-27T16:05:46.340Z","updatedAt":"2019-01-31T22:39:36.045Z","username":"+201144753259","password":"+201144753259","secondarySubscription":"{"__type": "Pointer", "className": "Subscription", "objectId": "xxxxxxxxxxx"}","primarySubscription":"{"__type": "Pointer", "className": "Subscription", "objectId": "fffffffff"}","services":null,"ACL":{"
":{"read":true},"UdMqp45eTs":{"read":true,"write":true}},"sessionToken":"r:46a7f17dd2aa364909530241a7bc5c94"}

so is that normal ??
also i think this is related to the logout issue i previously issued

[Idea] Callback with ParseException

Hi,

I think it could be a good idea if for maybe most of functions (signup, reset password, cloud codes functions, etc.), we can have a callback with firstly the object(s) and secondly the ParseException, like this example (from the official docs: https://docs.parseplatform.org/android/guide/#retrieving-objects) :

ParseQuery<ParseUser> query = ParseUser.getQuery();
query.whereEqualTo("gender", "female");
query.findInBackground(new FindCallback<ParseUser>() {
  public void done(List<ParseUser> objects, ParseException e) {
    if (e == null) {
        // The query was successful.
    } else {
        // Something went wrong.
    }
  }
});

And

ParseUser.requestPasswordResetInBackground("[email protected]", new RequestPasswordResetCallback() {
  public void done(ParseException e) {
    if (e == null) {
      // An email was successfully sent with reset instructions.
    } else {
      // Something went wrong. Look at the ParseException to see what's up.
    }
  }
});

With this, if we sign up a user and there is an error, we know which error is because for the moment, we can't know why it fails.

whereEqualTo Pointer returns no results

DB :
https://i.ibb.co/RQsn3CG/Untitled.jpg

when i try to query with

var query = QueryBuilder<SubscriptionParse>(SubscriptionParse())
  ..whereEqualTo('operator', 'E5um4KqOMD');
var response = await query.query();

i get no result found ,, shouldn't i get 5 results ?

SubscriptionParse Class :

import 'dart:core';

import 'package:AppName/screens/home/tele-services.dart';
import 'package:flutter/material.dart';
import 'package:parse_server_sdk/parse.dart';

class SubscriptionParse extends ParseObject implements ParseCloneable {
  SubscriptionParse() : super(_keyTableName);
  SubscriptionParse.clone() : this();

  @override
  clone(Map map) => SubscriptionParse.clone()..fromJson(map);

  static const String _keyTableName = 'Subscription';
  static const String _keyObjectID = 'objectId';
  static const String _keyOperator = 'operator';
  static const String _keyName = 'name';
  static const String _keyDescription = 'description';
  static const String _keyLogo = 'logo';

  String get name => get<String>(_keyName);
  set name(String name) => set<String>(_keyName, name);

  String get description => get<String>(_keyDescription);
  set description(String name) => set<String>(_keyDescription, description);

  String get logo => get<String>(_keyLogo);
  set logo(String logo) => set<String>(_keyLogo, logo);

  String get objectId => get<String>(_keyObjectID);
  set objectId(String objectId) => set<String>(_keyObjectID, objectId);

  String get operatorID => get(_keyOperator).toString();
  set operatorID(String operator) => set<String>(_keyOperator, operator);
}

Issue with Cloud function which returns list of custom object

Hi, I have a problem with Cloud Function.

When for exemple, I made this sample from the example in the lib :

void getAllItems() async {
    var apiResponse = await TestObject().getAll();

    if (apiResponse.success && apiResponse.result != null) {
      for (var test in apiResponse.result) {
        print(ApplicationConstants.keyAppName + ": " + (test as TestObject).title);
      }
    } else {
      print(ApplicationConstants.keyAppName + ": " + apiResponse.error.message);
    }
  }

I have this payload (with debug print, and it prints correctly the title of my test object in DB)

Payload: [{"className":"TestObject","objectId":"A","createdAt":"B","updatedAt":"C","title":"Hello"}]

But when I tried to retrieve it with Cloud Function, like this :

getObjects() async {
    var function = ParseCloudFunction('getObjects');
    ParseResponse response = await function.execute();
    return response;
  }

The payload is different from the first payload

Payload: [{title: Hello, createdAt: B, updatedAt: C, objectId: A, __type: Object, className: TestObject}]

And when I try to print the title of my test object like before (before, it works well), it doesn't work and I have this error :

Dart Error: Unhandled exception:
E/flutter (23910): type '_InternalLinkedHashMap<String, dynamic>' is not a subtype of type 'TestObject' in type cast

Examples

Any other example to see how to implement the methods equalto, greaterThan, MainQuery, livequeries, etc?

Thanks!

Cannot GET /parse/classes/TestObjectForApi

Hi, I just download example from your Repo, and update the application_constant.dart with my own configuration.

I run several test, but fail on Query():
healthcheck(); --> Passed
createItem(); --> Passed
query(); --> Fail

Reloaded 1 of 573 libraries in 4,582ms.
I/flutter (18233):
I/flutter (18233): ----
I/flutter (18233): API Response (ParseMain : ParseApiRQ.healthCheck) :
I/flutter (18233): Status Code: 200
I/flutter (18233): Payload: {status: ok}
I/flutter (18233): ----
I/flutter (18233):
I/flutter (18233): ----
I/flutter (18233): API Response (TestObjectForApi : ParseApiRQ.create) :
I/flutter (18233): Status Code: 201
I/flutter (18233): Payload: {"className":"className","objectId":"SceXYhHck2","createdAt":"2019-01-22T09:07:22.660Z"}
I/flutter (18233): ----
I/flutter (18233): app02: {"className":"className","objectId":"SceXYhHck2","createdAt":"2019-01-22T09:07:22.660Z"}
I/Choreographer(18233): Skipped 31 frames!  The application may be doing too much work on its main thread.
Reloaded 1 of 573 libraries in 4,748ms. //Change the runTestQueries() action from createItem() to query()
I/flutter (18233): start response
I/flutter (18233): Cannot GET /parse/classes/TestObjectForApi?where=%7B%7D
I/flutter (18233): Instance of 'Response'
I/flutter (18233): Instance of 'ParseResponse'
I/flutter (18233): end response
I/flutter (18233):
I/flutter (18233): ----
I/flutter (18233): API Response (TestObjectForApi : ParseApiRQ.query) :
I/flutter (18233): Status Code: -1
I/flutter (18233): Type: UnknownError
I/flutter (18233): Exception: FormatException: Unexpected character (at character 1)
I/flutter (18233): Cannot GET /parse/classes/TestObjectForApi?where=%7B%7D
I/flutter (18233): ^
I/flutter (18233):
I/flutter (18233): ----
I/flutter (18233): Result: FormatException: Unexpected character (at character 1)
I/flutter (18233): Cannot GET /parse/classes/TestObjectForApi?where=%7B%7D
I/flutter (18233): ^

I've check the "TestObjectForApi" classes permission, all is write-able and get-able, and I'm successfully fetch the created Objects from Postman.

void query() async {
    var queryBuilder = QueryBuilder<ParseObject>(ParseObject('TestObjectForApi'));
    //  ..setLimit(10)  
    //  ..includeObject(['Day']);

    var apiResponse = await queryBuilder.query();

    if (apiResponse.success && apiResponse.result != null) {
      print("Result: ${((apiResponse.result as List<dynamic>).first as ParseObject).toString()}");
    } else {
      print("Result: ${apiResponse.error.message}");
    }
  }

Thanks.

[Question/idea] Push notification possible ?

Hi,

Is it possible with the Flutter Parse SDK to send push notification ?

For exemple, send one notification to a specific user with his deviceToken and handle the push notification to redirect the user according to the payload of the notification ?

In advance, thank you.

Following tutorial, user login throws null exeption

Dart Error: Unhandled exception:
Failed assertion: boolean expression must not be null
#0 ParseUser._handleResponse
(file:///Users/cytaladen/.pub-cache/hosted/pub.dartlang.org/parse_server_sdk-1.0.2/lib/src/objects/parse_user.dart:185:22)
#1 ParseUser.signUp (file:///Users/cytaladen/.pub-cache/hosted/pub.dartlang.org/parse_server_sdk-1.0.2/lib/src/objects/parse_user.dart:79:5)

#2 ParseService.createUser (package:flutter_ui_experiments/parse_service.dart:40:39)

getAllItems() & query()

Hello,

I copy/paste the entire project, then I just set my 4 application constants and create a Diet_Plans table with 2 objects with the name "Test1" and "Test2.

When I call getAllItems()
`void getAllItems() async {
var response = await DietPlan().getAll();

if (response.success) {
  for (var plan in response.result) {
    print(ApplicationConstants.APP_NAME + ": " + (plan as DietPlan).name);
  }
} else {
  print(ApplicationConstants.APP_NAME + ": " + response.error.message);
}

}`

In my terminal, there is :
I/flutter ( 4409): Hello Flutter: Test2 I/flutter ( 4409): Hello Flutter: Test2

The problem is that getAllItems returns 2 objects but two times the last.
(it's the same with query())

In advance, thank you for your help.

[Solved] ParseGeoPoint doesn't work

Hi,

I have an object (DietPlan) which have a ParseGeoPoint (with real GPS location) but when I retrieve my object, there is a problem with the GeoPoint, I can't have the informations.

My full console :

Payload: {"className":"Diet_Plans","objectId":"lxeHxqnp8A","createdAt":"2019-01-16T09:30:19.147Z","updatedAt":"2019-01-21T15:01:39.774Z","Fat":10,"Name":"iet",","location":"{'__type': 'Pointer', className: GeoPoint, objectId: null}"}

The issue :

"location":"{'__type': 'Pointer', className: GeoPoint, objectId: null}

Thanks in advance

Plugin is not compiling

Hi,

I just tried to use yours plugin, but unfortunately I'm getting error every time I'm try to run a project with it.

* Where:
Script '/Users/piotrw/Library/flutter/packages/flutter_tools/gradle/flutter.gradle' line: 210

* What went wrong:
A problem occurred configuring project ':parse_server_sdk'.
> Could not find method debugProvided() for arguments [file collection] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.

I'm not sure, but from what I see in workspace with my IDE, and when I download whole archive from https://pub.dartlang.org/packages/parse_server_sdk#-versions-tab- there is lack of /android and /ios directories for this plugin. And You have those directories in your project on github. Maybe this is the reason of this error?

Could You take a look on that? Thanks in advance, and greetings!

sdk error: login function fails

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]

ParseUser.loginWith not alike all other methods

The newly added loginWith() method directly ParseUser object instead of ParseResponse.
We should try to keep the api consistent, what is the reason of not using _loginWith() as public interface and put the functionality of current loginWith() in application if needed?

signUp returns {"error":"unauthorized"}

Hi. I'm new to Parse. I started with adding signUp functionality, but I got stuck, and I am hoping you can help me.

I am running parse locally via docker-compose.

These two work:

$ curl -X POST -H "X-Parse-Application-Id: 'app'" -H "Content-Type: application/json" --data '{"username":"eseex","password":"cccc","email":"[email protected]"}' http://127.0.0.1/parse/users

$ curl -X POST -H "X-Parse-Application-Id: 'app'" -H "Content-Type: application/json" --data '{"username":"eeex","password":"cccc","email":"[email protected]"}' http://127.0.0.1/parse/classes/_User

Here is my code:

          Parse().initialize("app", "http://10.0.2.2/parse", debug: true);

          ParseUser user = ParseUser("testUser",
              "asfasfasfd", "[email protected]");
          ParseResponse response = await user.signUp();

Note the different ip address due to running from the emulator. I always receive:

{"error":"unauthorized"}

from these requests. I have spent a few hours debugging, but I just can't figure out where the problem is.

I suspect that there is something fundamental about Parse or running from an emulator that I am not understanding. Any help would be appreciated.

Here is the Parse configuration:

parse_1            | appId: 'app'
parse_1            | masterKey: ***REDACTED***
parse_1            | serverURL: http://127.0.0.1:1337/parse
parse_1            | masterKeyIps: []
parse_1            | appName: parse-server
parse_1            | logsFolder: ./logs
parse_1            | databaseURI: mongodb://bn_parse:82kRGAHhdF@mongodb:27017/bitnami_parse
parse_1            | userSensitiveFields: ["email"]
parse_1            | enableAnonymousUsers: true
parse_1            | allowClientClassCreation: true
parse_1            | maxUploadSize: 20mb
parse_1            | customPages: {}
parse_1            | sessionLength: 31536000
parse_1            | expireInactiveSessions: true
parse_1            | revokeSessionOnPasswordReset: true
parse_1            | schemaCacheTTL: 5000
parse_1            | cacheTTL: 5000
parse_1            | cacheMaxSize: 10000
parse_1            | objectIdSize: 10
parse_1            | port: 1337
parse_1            | host: 0.0.0.0
parse_1            | mountPath: /parse
parse_1            | scheduledPush: false
parse_1            | collectionPrefix: 
parse_1            | preserveFileName: false
parse_1            | verifyUserEmails: false
parse_1            | preventLoginWithUnverifiedEmail: false
parse_1            | enableSingleSchemaCache: false
parse_1            | enableExpressErrorHandler: false
parse_1            | jsonLogs: false
parse_1            | verbose: false
parse_1            | level: undefined

Note that I have redirection port 80 to 1337.

ParseInstallation timeZone missing

As explained in #95 currently there is no a proper way to get time zone as Parse Server expects in Flutter, one solution would be using platform specific code.

Slack Group

The Slack group FlutterParseSDK.Slack.com is privite? I can't join 😑

Version solving failed

Hey there. Importing this library with flutter test: any causes a clash in packages get:

Because every version of parse_server_sdk from git depends on http ^0.12.0 and every version of flutter_test from sdk depends on http 0.11.3+17, parse_server_sdk from git is incompatible with flutter_test from sdk.
So, because sms_and_contacts_db_importer depends on both flutter_test any from sdk and parse_server_sdk from git, version solving failed.

parseUser.currentUser() & .getCurrentUserFromServer()

Hello,

I copy/paste the project example, put my applications constants.

I sign up a user and login it. (I have the user in database with the session, it's good)

I restart my application and do my own code :
checkCurrentUser() async { // Best practice for starting the app. This will check for a var user = ParseUser.currentUser(); user = await user.getCurrentUserFromServer(); print("user: $user"); }

But in my terminal, I have this :
I/flutter (13889): I/flutter (13889): ---- I/flutter (13889): Hello Flutter API Response (_User : ParseApiRQ.currentUser) : I/flutter (13889): Status Code: 200 I/flutter (13889): Payload: {objectId: LjTOWTPE8D, createdAt: 2019-01-10T12:51:19.140Z, email: [email protected], username: TestFlutter, updatedAt: 2019-01-10T12:51:19.140Z, ACL: {*: {read: true}, LjTOWTPE8D: {read: true, write: true}}, sessionToken: r:5f7045a813f163282ac8a765eabf8cb6, __type: Object, className: _User} I/flutter (13889): ---- I/flutter (13889): user: Username: null I/flutter (13889): Email Address:null

The problem is that it seems that the user is retrieved but when I print my user variable, it's null.

In advance, thank you.

Log in with token

Hey, I need to login the user from a token. What do you think about this code? I can do a PR if its ok.

  Future<ParseResponse> getCurrentUserFromServer({token}) async {
    // We can't get the current user and session without a sessionId

    if(token==null && _client.data.sessionId == null) {
      return null;
    }

    if(token == null){
      token = _client.data.sessionId;
    }

    try {
      Uri tempUri = Uri.parse(_client.data.serverUrl);

      Uri uri = Uri(
          scheme: tempUri.scheme,
          host: tempUri.host,
          path: "${tempUri.path}$keyEndPointUserName");

      final response = await _client.get(uri, headers: {keyHeaderSessionToken: token});
      return _handleResponse(response, ParseApiRQ.currentUser);
    } on Exception catch (e) {
      return _handleException(e, ParseApiRQ.currentUser);
    }
  }

With this changes, I can do the following:

  initUserFromToken () async{
    ParseUser user = new ParseUser(null,null,null);
    var response = await user.getCurrentUserFromServer(token:"r:78095e44937ff1732f18ea04d04ad67e");
    if (response.success){
      user = await ParseUser.currentUser();
      print("user"+user.get(ParseUser.keyUsername));
    }
  }

[Error when object update] schema mismatch for Diet_Plans.createdAt; expected Date but got String

Hi,

There is a problem with the object update, this is my code :
`updateDietPlan() async {
var response = await DietPlan().getObject('U4FyTrkpBH');

if (response.success) {
  var dietPlan = (response.result as DietPlan);
  print("(before update) dietPlan: $dietPlan");

  dietPlan.set<int>('Fat', 666);
  print("(after update) dietPlan: $dietPlan");
  dietPlan.save();
} else {
  print(ApplicationConstants.APP_NAME + ": " + response.error.message);
}

}`

And this is the console:
I/flutter (17474): I/flutter (17474): ---- I/flutter (17474): Hello Flutter API Response (Diet_Plans : ParseApiRQ.get) : I/flutter (17474): Status Code: 200 I/flutter (17474): Payload: {"objectId":"U4FyTrkpBH","Name":"Test1","createdAt":"2019-01-11T10:40:08.121Z","updatedAt":"2019-01-11T10:40:52.692Z","Fat":11} I/flutter (17474): ---- I/flutter (17474): (before update) dietPlan: {"objectId":"U4FyTrkpBH","Name":"Test1","createdAt":"2019-01-11T10:40:08.121Z","updatedAt":"2019-01-11T10:40:52.692Z","Fat":11} I/flutter (17474): (after update) dietPlan: {"objectId":"U4FyTrkpBH","Name":"Test1","createdAt":"2019-01-11T10:40:08.121Z","updatedAt":"2019-01-11T10:40:52.692Z","Fat":666} I/flutter (17474): I/flutter (17474): ---- I/flutter (17474): Hello Flutter API Response (Diet_Plans : ParseApiRQ.save) : I/flutter (17474): Status Code: 111 I/flutter (17474): Type: IncorrectType I/flutter (17474): Error: schema mismatch for Diet_Plans.createdAt; expected Date but got String I/flutter (17474): ----

In advance, thank you.

Sugestion: Update Sample Code with New Functions

Hello, @phillwiggins.

I would like to make a suggestion:

When a contributor provides a new functionality in the lib, it would be interesting to update the sample code, demonstrating its use.

For example, we have the new functionalities of anonymous login, login using authdata, ParseFile, ParseInstallation, but this is not documented.

These features I'm updating the sample code to document.

At the time of the merge, you could check and request the upgrade. What do you think of this?

Congratulations on your initiative to develop lib and I'm really happy to collaborate with it.

Create and update object

Hello,

I think it's not an issue but I try to create and update a Diet_Plans but I didn't succeed.

Is it possible to update the documentation/tutorial to make a CRUD for Diet_Plans ?

Because, when I try this code from the README :
var dietPlan = ParseObject('DietPlan') ..setValue('Name', 'Ketogenic') ..setValue('Fat', 65);
My IDE tell me: The method 'setValue' isn't defined for the class 'ParseObject'.

In advance, thank you.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.