# Getting Error While Calling the Authorization Code Grant

**URL:** <https://community.open-emr.org/t/getting-error-while-calling-the-authorization-code-grant/16300>\
**Category:** OpenEMR Development\
**Created:** [March 19, 2021, 8:56am UTC](https://community.open-emr.org/t/getting-error-while-calling-the-authorization-code-grant/16300 "2021-03-19T08:56:59Z")\
**Posts on this page:** 1\
**Showing post:** 16

<div class="post-metadata">

**Author:** ![adunsulag](https://community.open-emr.org/user_avatar/community.open-emr.org/adunsulag/32/12606_2.png) [@adunsulag](https://community.open-emr.org/u/adunsulag)\
**Post date:** [June 24, 2021, 11:40am UTC](https://community.open-emr.org/t/getting-error-while-calling-the-authorization-code-grant/16300/16 "2021-06-24T11:40:17Z")

</div>

Did you try changing the certificate folder permissions? Make sure your webserver user has write access to the folder. You should have the folder set to 755 to be able to write there.  
 ![image](https://discourse-uploads-openemr.s3.dualstack.us-east-1.amazonaws.com/original/3X/2/b/2b51bcdf068cfeec6d393dd2fae46c3ae6502fc0.png)

I’m not sure why I’ve had to do this sometimes, but there are times when the key files fail to write out that I’ve had to clear the oauth2 private keys in the database. They are found in the `keys` table and you may need to delete the **oauth2key** and **oauth2passphrase** entries.

 ![image](https://discourse-uploads-openemr.s3.dualstack.us-east-1.amazonaws.com/original/3X/6/6/663a1b8c7187fcaafe5f9f7a0d1b3d331aa8148a.png)

One thing I would mention is that I hope you are working off of master because you are doing development. If you are upgrading a production machine, its not a great idea to work off of master as there are lots of unstable features that could mess you up. I only mention this since you said you ‘upgraded’ this instance.

---

_[View the full topic](https://community.open-emr.org/t/getting-error-while-calling-the-authorization-code-grant/16300)._
