function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Tejaswini NidumukkalaTejaswini Nidumukkala 

Could not retrieve the username after successful auth code exchange. Due to: The REST API is not enabled for this Organization.  This is most likely not an error with the Salesforce CLI.

Could not retrieve the username after successful auth code exchange. Due to: The REST API is not enabled for this Organization.  This is most likely not an error with the Salesforce CLI. Please ensure all information is accurate and try again.  Getting this error how to solve this in my local and I am using trial developer credentials
SwethaSwetha (Salesforce Developers) 
HI Tejaswini,
What is the edition of your salesforce org? (Click path: Setup> Quick find> Company Information> "Organization Edition" field)

I'd recommend checking  https://help.salesforce.com/s/articleView?id=000385436&type=1 for details on the Org Editions and API access

Editions with API Access: 
Enterprise Edition
Unlimited Edition
Developer Edition
Performance Edition

Editions without API Access:
Group Edition
Essentials Edition
Professional Edition (can be purchased as an add-on)

With a Trail Edition org, you will want an Enterprise Edition org.

Once API access is enabled for your org, you can provide access to your profile following the steps from this post and then you will not see this error.

If this information helps, please mark the answer as best. Thank you
sivasankar.ksivasankar.k

Hi Tejaswini,

Please refer to the article, which can help you Error 'API not enabled for this Organization or Partner (https://help.salesforce.com/s/articleView?id=000385535&type=1)

Thank you.
Siva