# Error updating user preferences. Credentials not provided?

**URL:** <https://discuss.openedx.org/t/error-updating-user-preferences-credentials-not-provided/643>\
**Category:** Development\
**Created:** [October 7, 2019, 2:33pm UTC](https://discuss.openedx.org/t/error-updating-user-preferences-credentials-not-provided/643 "2019-10-07T14:33:44Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![vrios](https://avatars.discourse-cdn.com/v4/letter/v/e495f1/32.png) [@vrios](https://discuss.openedx.org/u/vrios)\
**Post date:** [October 7, 2019, 2:33pm UTC](https://discuss.openedx.org/t/error-updating-user-preferences-credentials-not-provided/643/1 "2019-10-07T14:33:44Z")

</div>

So,

I am still working through enabling badging.

Right now Im getting the error mentioned when I update user preferences after earning a badge.

I can’t change the profile picture, bio, similar for a long period.

I understand this may have to do with JWT.

[Cant upload images as a new user](https://drive.google.com/file/d/1L1iy6N_N5Kmu-dJ-HdFLJrdq63iyuHBm/view?usp=sharing)

Im not sure how to get out of this error loop, obtain a new JWT token each time I earn a badge somehow?, as no error is being logged on lms or apache.

Thanks for reading this far

---

<div class="post-metadata">

**Author:** ![vrios](https://avatars.discourse-cdn.com/v4/letter/v/e495f1/32.png) [@vrios](https://discuss.openedx.org/u/vrios)\
**Post date:** [October 8, 2019, 12:18pm UTC](https://discuss.openedx.org/t/error-updating-user-preferences-credentials-not-provided/643/2 "2019-10-08T12:18:13Z")

</div>

Looking at the logs I can get as far as requesting a user’s badge assertions then I am logged out.

Here is a gist showing what I can see [https://gist.github.com/vicnete/143e8fab73137f37b6aadebea37dd35e](https://gist.github.com/vicnete/143e8fab73137f37b6aadebea37dd35e)

After a while it works and both of the requests include the username.

I am trying to figure out:

What may be causing this?  
Why is it fixed after about 8 minutes?(some sort of user cache that logs me out when it is inconsistent is my best guess at the moment).

I have an idea of a fix for my situation, there is a solution manually and we could replicate what that solution is calling every time we issue a badge, but we need to get rid of the 8 minute/similar time cache.

Asking our users to wait around for 10 minutes before accessing their profile after earning a badge seems less than ideal.

---

<div class="post-metadata">

**Author:** ![vrios](https://avatars.discourse-cdn.com/v4/letter/v/e495f1/32.png) [@vrios](https://discuss.openedx.org/u/vrios)\
**Post date:** [October 30, 2019, 2:28pm UTC](https://discuss.openedx.org/t/error-updating-user-preferences-credentials-not-provided/643/3 "2019-10-30T14:28:34Z")

</div>

We have a working fix using badgr-server without needing any model changes!! 🎉.

On badgr server code/apps/mainsite/settings.py go to middleware classes and remove/comment ‘badgeuser.middleware.InactiveUserMiddleware’,

Now go to badgr server /code/apps/issuer/admin.py and remove entity\_id from the readonly fields of BadgeClassAdmin.

You would have to edit the slug using the barebones interface(can’t figure out the commit that made entity\_id field readonly on badgr-ui).

Once it is editable you can make it match the query edx sends once a particular badge is earnt. Badge queries sent by edx follow the format openedx\_\_coursebadgeslug provided that openedx\_\_course is used as a issuing component and badgeslug is the slug we have defined for this badge class on edx from the admin panel.  
I would expect the queries to follow the pattern of issuing componentbadgeslug if you don’t use openedx\_\_course as an issuing component but I am afraid to test it out after seeing some odd behaviour when testing similar functionalities.

The solution described above, 2 single statement file changes on a badgr server instalation, works like a charm and doesnt kick the user out after earning a badge
