com.parse.ParseRequest$ParseRequestException: unauthorized

  • Replies:1
  • OpenNot stickiedUnanswered
  • Forum posts: 2

Aug 2, 2016 4:37:59 PM via Website

I am new in android. Well I am trying to send data to parse cloud, but I am getting this exception.

com.parse.ParseRequest$ParseRequestException: unauthorized

Here is the MainActivity class.

/*
* Copyright (c) 2015-present, Parse, LLC.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
package com.parse.starter;

import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;

import com.parse.ParseAnalytics;
import com.parse.ParseException;
import com.parse.ParseObject;
import com.parse.SaveCallback;


public class MainActivity extends AppCompatActivity {

  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

      ParseObject score = new ParseObject("Score");
      score.put("username","azeem");
      score.put("score","199");
      score.saveInBackground(new SaveCallback() {
          @Override
          public void done(ParseException e) {
              if (e == null)
              {
                  Log.i("SaveInBackground","Succesfully");
              }
              else {
                  Log.i("SaveInBackground","Failed");
                  e.printStackTrace();
              }
          }
      });

      ParseAnalytics.trackAppOpenedInBackground(getIntent());

  }

  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.menu_main, menu);
    return true;
  }

  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
    // Handle action bar item clicks here. The action bar will
    // automatically handle clicks on the Home/Up button, so long
    // as you specify a parent activity in AndroidManifest.xml.
    int id = item.getItemId();

    //noinspection SimplifiableIfStatement
    if (id == R.id.action_settings) {
      return true;
    }

    return super.onOptionsItemSelected(item);
  }
}

And here is the logcat.

8-02 16:03:14.278 2542-2542/com.parse.starter I/art: Not late-enabling -Xcheck:jni (already on)
08-02 16:03:14.356 2542-2542/com.parse.starter W/System: ClassLoader referenced unknown path: /data/app/com.parse.starter-2/lib/x86
08-02 16:03:20.832 2542-2542/com.parse.starter W/System: ClassLoader referenced unknown path: /data/app/com.parse.starter-2/lib/x86
08-02 16:03:21.431 2542-2548/com.parse.starter W/art: Suspending all threads took: 80.123ms
08-02 16:03:22.473 2542-2548/com.parse.starter W/art: Suspending all threads took: 120.266ms
08-02 16:03:22.642 2542-2552/com.parse.starter I/art: Background sticky concurrent mark sweep GC freed 16012(1690KB) AllocSpace objects, 8(164KB) LOS objects, 69% free, 1121KB/3MB, paused 823us total 115.234ms
08-02 16:03:25.669 2542-2548/com.parse.starter W/art: Suspending all threads took: 2.314s
08-02 16:03:26.291 2542-2548/com.parse.starter W/art: Suspending all threads took: 431.859ms
08-02 16:03:26.369 2542-2548/com.parse.starter W/art: Suspending all threads took: 9.786ms
08-02 16:03:26.814 2542-2992/com.parse.starter D/OpenGLRenderer: Use EGL_SWAP_BEHAVIOR_PRESERVED: true

                                                                 [ 08-02 16:03:26.823  2542: 2542 D/         ]
                                                                 HostConnection::get() New Host Connection established 0xaa1a8560, tid 2542
08-02 16:03:26.875 2542-2548/com.parse.starter W/art: Suspending all threads took: 14.603ms
08-02 16:03:26.899 2542-2992/com.parse.starter I/OpenGLRenderer: Initialized EGL, version 1.4
08-02 16:03:27.395 2542-2548/com.parse.starter W/art: Suspending all threads took: 34.582ms
08-02 16:03:28.902 2542-2548/com.parse.starter W/art: Suspending all threads took: 536.386ms
08-02 16:19:43.659 2542-2548/com.parse.starter W/art: Suspending all threads took: 7.097ms
08-02 16:19:48.994 2542-2883/com.parse.starter W/System: ClassLoader referenced unknown path: /data/data/com.parse.starter/lib
08-02 16:19:49.119 2542-2992/com.parse.starter E/Surface: getSlotFromBufferLocked: unknown buffer: 0xa9a52620
08-02 16:19:49.313 2542-2992/com.parse.starter V/RenderScript: 0xa0f87000 Launching thread(s), CPUs 2
08-02 16:19:51.063 2542-2992/com.parse.starter E/Surface: getSlotFromBufferLocked: unknown buffer: 0xa9a52690
08-02 16:19:54.880 2542-2542/com.parse.starter W/art: Before Android 4.1, method int android.support.v7.internal.widget.ListViewCompat.lookForSelectablePosition(int, boolean) would have incorrectly overridden the package-private method in android.widget.ListView
08-02 16:19:56.241 2542-2992/com.parse.starter E/Surface: getSlotFromBufferLocked: unknown buffer: 0xa9a52690
08-02 16:20:43.221 2542-2883/com.parse.starter W/System: ClassLoader referenced unknown path: /data/data/com.parse.starter/lib
08-02 16:20:43.259 2542-2992/com.parse.starter E/Surface: getSlotFromBufferLocked: unknown buffer: 0xa9a52620
08-02 16:20:45.238 2542-2992/com.parse.starter E/Surface: getSlotFromBufferLocked: unknown buffer: 0xa9a52620
08-02 16:25:09.700 2542-2992/com.parse.starter E/Surface: getSlotFromBufferLocked: unknown buffer: 0xa9a52ee0
08-02 16:57:48.310 2542-2992/com.parse.starter E/Surface: getSlotFromBufferLocked: unknown buffer: 0xa9a525b0
08-02 16:58:45.961 18271-18271/com.parse.starter W/System: ClassLoader referenced unknown path: /data/app/com.parse.starter-1/lib/x86
08-02 16:58:53.160 18271-18271/com.parse.starter W/System: ClassLoader referenced unknown path: /data/app/com.parse.starter-1/lib/x86
08-02 16:58:53.427 18271-18531/com.parse.starter D/OpenGLRenderer: Use EGL_SWAP_BEHAVIOR_PRESERVED: true

                                                                   [ 08-02 16:58:53.431 18271:18271 D/         ]
                                                                   HostConnection::get() New Host Connection established 0xaa1a87d0, tid 18271


                                                                   [ 08-02 16:58:53.496 18271:18531 D/         ]
                                                                   HostConnection::get() New Host Connection established 0xadc47ba0, tid 18531
08-02 16:58:53.501 18271-18531/com.parse.starter I/OpenGLRenderer: Initialized EGL, version 1.4
08-02 17:09:48.803 20084-20084/com.parse.starter W/System: ClassLoader referenced unknown path: /data/app/com.parse.starter-2/lib/x86
08-02 17:09:53.513 20084-20084/com.parse.starter W/System: ClassLoader referenced unknown path: /data/app/com.parse.starter-2/lib/x86
08-02 17:09:53.870 20084-20192/com.parse.starter D/OpenGLRenderer: Use EGL_SWAP_BEHAVIOR_PRESERVED: true

                                                                   [ 08-02 17:09:53.875 20084:20084 D/         ]
                                                                   HostConnection::get() New Host Connection established 0xaa1a76f0, tid 20084


                                                                   [ 08-02 17:09:53.913 20084:20192 D/         ]
                                                                   HostConnection::get() New Host Connection established 0xadc47b70, tid 20192
08-02 17:09:53.917 20084-20192/com.parse.starter I/OpenGLRenderer: Initialized EGL, version 1.4
08-02 17:15:47.485 25321-25321/com.parse.starter W/System: ClassLoader referenced unknown path: /data/app/com.parse.starter-2/lib/x86
08-02 17:15:49.386 25321-25321/com.parse.starter W/System: ClassLoader referenced unknown path: /data/app/com.parse.starter-2/lib/x86
08-02 17:15:49.730 25321-25384/com.parse.starter D/OpenGLRenderer: Use EGL_SWAP_BEHAVIOR_PRESERVED: true

                                                                   [ 08-02 17:15:49.733 25321:25321 D/         ]
                                                                   HostConnection::get() New Host Connection established 0xaa1a9010, tid 25321


                                                                   [ 08-02 17:15:49.763 25321:25384 D/         ]
                                                                   HostConnection::get() New Host Connection established 0xaa1a8e60, tid 25384
08-02 17:15:49.769 25321-25384/com.parse.starter I/OpenGLRenderer: Initialized EGL, version 1.4
08-02 17:16:16.054 25321-25321/com.parse.starter I/SaveInBackground: Failed
08-02 17:16:16.055 25321-25321/com.parse.starter W/System.err: com.parse.ParseRequest$ParseRequestException: unauthorized
08-02 17:16:16.055 25321-25321/com.parse.starter W/System.err:     at com.parse.ParseRequest.newPermanentException(ParseRequest.java:270)
08-02 17:16:16.055 25321-25321/com.parse.starter W/System.err:     at com.parse.ParseRESTCommand.onResponseAsync(ParseRESTCommand.java:301)
08-02 17:16:16.055 25321-25321/com.parse.starter W/System.err:     at com.parse.ParseRESTUserCommand.onResponseAsync(ParseRESTUserCommand.java:126)
08-02 17:16:16.055 25321-25321/com.parse.starter W/System.err:     at com.parse.ParseRequest$3.then(ParseRequest.java:137)
08-02 17:16:16.055 25321-25321/com.parse.starter W/System.err:     at com.parse.ParseRequest$3.then(ParseRequest.java:133)
08-02 17:16:16.055 25321-25321/com.parse.starter W/System.err:     at bolts.Task$15.run(Task.java:917)
08-02 17:16:16.055 25321-25321/com.parse.starter W/System.err:     at bolts.BoltsExecutors$ImmediateExecutor.execute(BoltsExecutors.java:105)
08-02 17:16:16.055 25321-25321/com.parse.starter W/System.err:     at bolts.Task.completeAfterTask(Task.java:908)
08-02 17:16:16.055 25321-25321/com.parse.starter W/System.err:     at bolts.Task.continueWithTask(Task.java:715)
08-02 17:16:16.055 25321-25321/com.parse.starter W/System.err:     at bolts.Task.continueWithTask(Task.java:726)
08-02 17:16:16.055 25321-25321/com.parse.starter W/System.err:     at bolts.Task$13.then(Task.java:818)
08-02 17:16:16.055 25321-25321/com.parse.starter W/System.err:     at bolts.Task$13.then(Task.java:806)
08-02 17:16:16.055 25321-25321/com.parse.starter W/System.err:     at bolts.Task$15.run(Task.java:917)
08-02 17:16:16.055 25321-25321/com.parse.starter W/System.err:     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
08-02 17:16:16.055 25321-25321/com.parse.starter W/System.err:     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
08-02 17:16:16.055 25321-25321/com.parse.starter W/System.err:     at java.lang.Thread.run(Thread.java:818)
  • Forum posts: 23

Aug 11, 2016 11:43:26 PM via Website

Check if you have initialized your keys in Application.OnCreate

And try to move away from Parse since they are shutting down their service this January