Skip to content
This repository has been archived by the owner on May 6, 2024. It is now read-only.

Unknown error in Native Find Courses #697

Closed
ghost opened this issue May 10, 2016 · 6 comments
Closed

Unknown error in Native Find Courses #697

ghost opened this issue May 10, 2016 · 6 comments

Comments

@ghost
Copy link

ghost commented May 10, 2016

Hello,

I tried to use the Native Find Courses activity, but I got a 403 response. I also tried to curl /api/courses/v1/courses/?username=staff&mobile=true&page=1 using command line with the provided Authorization: Bearer f7a30affaa193813354137eb47c59cb3f9ac974e, but the same thing happened. However, it works perfectly in the website. Any recommendations?

Here's the logs:

05-10 14:30:04.328 30710-30710/org.edx.mobile D/org.edx.mobile.view.NativeFindCoursesActivity: created
05-10 14:30:04.390 30710-30880/org.edx.mobile W/EGL_emulation: eglSurfaceAttrib not implemented
05-10 14:30:04.390 30710-30880/org.edx.mobile W/OpenGLRenderer: Failed to set EGL_SWAP_BEHAVIOR on surface 0x9e833160, error=EGL_SUCCESS
05-10 14:30:04.448 30710-30710/org.edx.mobile D/org.edx.mobile.util.NetworkUtil: Mobile data is connected
05-10 14:30:04.459 30710-17647/org.edx.mobile D/OkHttp: --> GET http://localhost:8000/api/courses/v1/courses/?username=staff&mobile=true&page=1 HTTP/1.1
05-10 14:30:04.459 30710-17647/org.edx.mobile D/OkHttp: User-Agent: Dalvik/2.1.0 (Linux; U; Android 6.0; Android SDK built for x86 Build/MASTER) edx/org.edx.mobile/0.7.8
05-10 14:30:04.459 30710-17647/org.edx.mobile D/OkHttp: Authorization: Bearer f7a30affaa193813354137eb47c59cb3f9ac974e
05-10 14:30:04.459 30710-17647/org.edx.mobile D/OkHttp: --> END GET
05-10 14:30:04.618 30710-30716/org.edx.mobile W/art: Suspending all threads took: 53.842ms
05-10 14:30:04.634 30710-30880/org.edx.mobile E/Surface: getSlotFromBufferLocked: unknown buffer: 0xa0ac2e70
05-10 14:30:04.673 30710-30720/org.edx.mobile I/art: Background sticky concurrent mark sweep GC freed 47791(2MB) AllocSpace objects, 3(376KB) LOS objects, 25% free, 8MB/11MB, paused 8.031ms total 204.170ms
05-10 14:30:04.680 30710-17647/org.edx.mobile D/OkHttp: <-- 403 FORBIDDEN http://localhost:8000/api/courses/v1/courses/?username=staff&mobile=true&page=1 (220ms)
05-10 14:30:04.680 30710-17647/org.edx.mobile D/OkHttp: Allow: GET, HEAD, OPTIONS
05-10 14:30:04.680 30710-17647/org.edx.mobile D/OkHttp: Content-Language: ar
05-10 14:30:04.680 30710-17647/org.edx.mobile D/OkHttp: Content-Type: application/json
05-10 14:30:04.680 30710-17647/org.edx.mobile D/OkHttp: Date: Tue, 10 May 2016 11:30:48 GMT
05-10 14:30:04.680 30710-17647/org.edx.mobile D/OkHttp: Server: nginx
05-10 14:30:04.680 30710-17647/org.edx.mobile D/OkHttp: Set-Cookie: sessionid=wfng21dv3woz2rqrlh15mj72btjlvi2v; Domain=.edxbeta.org; expires=Tue, 24-May-2016 11:30:48 GMT; httponly; Max-Age=1209600; Path=/; secure
05-10 14:30:04.680 30710-17647/org.edx.mobile D/OkHttp: Vary: Accept-Encoding
05-10 14:30:04.680 30710-17647/org.edx.mobile D/OkHttp: Vary: Accept, Accept-Language, Cookie
05-10 14:30:04.680 30710-17647/org.edx.mobile D/OkHttp: X-Frame-Options: SAMEORIGIN
05-10 14:30:04.680 30710-17647/org.edx.mobile D/OkHttp: Connection: keep-alive
05-10 14:30:04.681 30710-17647/org.edx.mobile D/OkHttp: OkHttp-Sent-Millis: 1462879804460
05-10 14:30:04.681 30710-17647/org.edx.mobile D/OkHttp: OkHttp-Received-Millis: 1462879804679
05-10 14:30:04.681 30710-17647/org.edx.mobile D/OkHttp: {"detail":"You do not have permission to perform this action."}
05-10 14:30:04.681 30710-17647/org.edx.mobile D/OkHttp: <-- END HTTP (79-byte body)
05-10 14:30:04.681 30710-17647/org.edx.mobile W/org.edx.mobile.http.RetroHttpExceptionHandler: url = http://localhost:8000/api/courses/v1/courses/?username=staff&mobile=true&page=1
05-10 14:30:04.683 30710-17647/org.edx.mobile W/org.edx.mobile.http.RetroHttpExceptionHandler: kind = HTTP
05-10 14:30:04.683 30710-17647/org.edx.mobile W/org.edx.mobile.http.RetroHttpExceptionHandler: body = {"detail":"You do not have permission to perform this action."}
05-10 14:30:04.683 30710-17647/org.edx.mobile W/org.edx.mobile.http.RetroHttpExceptionHandler: status and reason = 403:FORBIDDEN
05-10 14:30:04.683 30710-30710/org.edx.mobile E/org.edx.mobile.util.images.ErrorUtils: org.edx.mobile.http.RetroHttpException: retrofit.RetrofitError: 403 FORBIDDEN
                                                                                                 at org.edx.mobile.http.RetroHttpExceptionHandler.handleError(RetroHttpExceptionHandler.java:23)
                                                                                                 at retrofit.RestAdapter$RestHandler.invoke(RestAdapter.java:242)
                                                                                                 at java.lang.reflect.Proxy.invoke(Proxy.java:393)
                                                                                                 at $Proxy24.getCourseList(Unknown Source)
                                                                                                 at org.edx.mobile.course.CourseAPI.getCourseList(CourseAPI.java:35)
                                                                                                 at org.edx.mobile.course.GetCourseListTask.call(GetCourseListTask.java:26)
                                                                                                 at org.edx.mobile.course.GetCourseListTask.call(GetCourseListTask.java:11)
                                                                                                 at roboguice.util.SafeAsyncTask$SafeAsyncTaskAndroidCallable.doInBackground(SafeAsyncTask.java:163)
                                                                                                 at roboguice.util.AndroidCallableWrapper.doDoInBackgroundThread(AndroidCallableWrapper.java:113)
                                                                                                 at roboguice.util.AndroidCallableWrapper.run(AndroidCallableWrapper.java:41)
                                                                                                 at roboguice.util.AndroidCallable.run(AndroidCallable.java:20)
                                                                                                 at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:423)
                                                                                                 at java.util.concurrent.FutureTask.run(FutureTask.java:237)
                                                                                                 at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
                                                                                                 at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
                                                                                                 at java.lang.Thread.run(Thread.java:818)
                                                                                                 at dalvik.system.VMStack.getThreadStackTrace(Native Method)
                                                                                                 at java.lang.Thread.getStackTrace(Thread.java:580)
                                                                                                 at roboguice.util.AndroidCallable.<init>(AndroidCallable.java:12)
                                                                                                 at roboguice.util.SafeAsyncTask$SafeAsyncTaskAndroidCallable.<init>(SafeAsyncTask.java:160)
                                                                                                 at roboguice.util.SafeAsyncTask.newTask(SafeAsyncTask.java:156)
                                                                                                 at roboguice.util.SafeAsyncTask.future(SafeAsyncTask.java:66)
                                                                                                 at roboguice.util.SafeAsyncTask.execute(SafeAsyncTask.java:94)
                                                                                                 at roboguice.util.SafeAsyncTask.execute(SafeAsyncTask.java:90)
                                                                                                 at org.edx.mobile.view.dialog.NativeFindCoursesFragment$2.loadNextPage(NativeFindCoursesFragment.java:84)
                                                                                                 at org.edx.mobile.view.adapters.InfiniteScrollUtils$PageLoadController.onLoadMore(InfiniteScrollUtils.java:159)
                                                                                                 at org.edx.mobile.view.adapters.InfiniteScrollUtils$PageLoadController.onLoadMore(InfiniteScrollUtils.java:144)
                                                                                                 at org.edx.mobile.view.adapters.InfiniteScrollUtils$PageLoadController.access$000(InfiniteScrollUtils.java:119)
                                                                                                 at org.edx.mobile.view.adapters.InfiniteScrollUtils.configureListViewWithInfiniteList(InfiniteScrollUtils.java:43)
                                                                                                 at org.edx.mobile.view.dialog.NativeFindCoursesFragment.onViewCreated(NativeFindCoursesFragment.java:55)
                                                                                                 at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1086)
                                                                                                 at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1252)
                                                                                                 at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:742)
                                                                                                 at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1617)
                                                                                                 at android.support.v4.app.FragmentController.execPendingActions(FragmentController.java:339)
                                                                                                 at android.support.v4.app.FragmentActivity.onResume(FragmentActivity.java:484)
                                                                                                 at org.edx.mobile.base.RoboAppCompatActivity.onResume(RoboAppCompatActivity.java:87)
                                                                                                 at org.edx.mobile.base.BaseFragmentActivity.onResume(BaseFragmentActivity.java:102)
                                                                                                 at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1258)
                                                                                                 at android.app.Activity.performResume(Activity.java:6312)
                                                                                                 at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3092)
                                                                                                 at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3134)
                                                                                                 at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2481)
                                                                                                 at android.app.ActivityThread.-wrap11(ActivityThread.java)
                                                                                                 at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
                                                                                                 at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                                                 at android.os.Looper.loop(Looper.java:148)
                                                                                                 at android.app.ActivityThread.main(ActivityThread.java:5417)
                                                                                                 at java.lang.reflect.Method.invoke(Native Method)
                                                                                                 at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
                                                                                                 at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
05-10 14:30:04.684 30710-30710/org.edx.mobile D/Event: No subscribers registered for event class org.edx.mobile.logger.Logger$CrashReportEvent
05-10 14:30:04.684 30710-30710/org.edx.mobile D/Event: No subscribers registered for event class de.greenrobot.event.NoSubscriberEvent
05-10 14:30:58.898 30710-30716/org.edx.mobile W/art: Suspending all threads took: 5.154ms
05-10 14:37:04.972 30710-30716/org.edx.mobile W/art: Suspending all threads took: 24.946ms
05-10 14:44:38.295 30710-30716/org.edx.mobile W/art: Suspending all threads took: 11.793ms
05-10 14:48:21.699 30710-30716/org.edx.mobile W/art: Suspending all threads took: 10.982ms

@aleffert
Copy link
Contributor

403 suggests there's a problem with your token. I assume you were logged in as stuff at the time? Do you know if other end points work with the token you used?

@ghost
Copy link
Author

ghost commented May 10, 2016

Thanks @aleffert for your response.

I do not think that there's a problem in my token since I used it in curling enrllement API to make sure it's valid and it worked. Besides, I think it's been used in every module needed authentication within the app, but the only place I got a 403 is in the Native Find Courses module.
I logged in the server and requested it in the browser using the API link and it works fine.

Is there's any change in edx-platform repo after dogwood-rc2 I must be aware of? Since if it is a problem in the App, the CURL should work properly as far as I know. Anyhow, I tried merging the latest version of the platform but the same problem remains.

@BenjiLee
Copy link
Contributor

BenjiLee commented May 10, 2016

The description for the 403 for this particular endpoint is,
`403 if a user who does not have permission to masquerade as
another user specifies a username other than their own.``

I'm also having trouble trying to reproduce this issue from the app itself. I am using the latest master on edx-app-android and master on edx-platform as recent as yesterday.

I do get a 403 when trying to access /api/courses/v1/courses/?username=staff&mobile=true&page=1 as a different user on the browser.

What happens when you try to login with a user other than staff?

@ghost
Copy link
Author

ghost commented May 11, 2016

I used the latest version of edx-platform and everything's worked fine. The problem was this feature is not supported in dogwood-rc2.

Closing now. Thanks for your fast response and consideration.

@ghost ghost closed this as completed May 11, 2016
@jazztpt
Copy link

jazztpt commented May 24, 2016

I'm having the same problem. I'm using iOS 2.3.1 and edx-platform named-release/dogwood.3. Should I be using a newer version? Any other ideas what causes this 403 error?

@iamjazzar
Copy link
Contributor

@jazztpt, I think you need to pull the master. The named-release/dogwood.3 hash is: e8186a1 which is the same as named-release/dogwood.2 one.

This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants