# OAuthError: The client is not authorized to use the provided grant type. Configured grant types

**URL:** <https://devforum.okta.com/t/oautherror-the-client-is-not-authorized-to-use-the-provided-grant-type-configured-grant-types/27862>\
**Category:** OAuth/OIDC\
**Created:** [April 22, 2024, 3:43pm UTC](https://devforum.okta.com/t/oautherror-the-client-is-not-authorized-to-use-the-provided-grant-type-configured-grant-types/27862 "2024-04-22T15:43:38Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![shirukento1](https://avatars.discourse-cdn.com/v4/letter/s/d2c977/32.png) [@shirukento1](https://devforum.okta.com/u/shirukento1)\
**Post date:** [April 22, 2024, 3:43pm UTC](https://devforum.okta.com/t/oautherror-the-client-is-not-authorized-to-use-the-provided-grant-type-configured-grant-types/27862/1 "2024-04-22T15:43:38Z")

</div>

-I don’t know why it doesn’t work when I launch it. I’m using Angular 17 stadalone combined with Okta-signin-widget. Can someone help me?

app.config.ts  
import { ApplicationConfig, importProvidersFrom } from ‘@angular/core’;  
import { provideRouter } from ‘@angular/router’;

import { routes } from ‘./app.routes’;  
import { provideClientHydration } from ‘@angular/platform-browser’;  
import { provideHttpClient } from ‘@angular/common/http’;  
import { OKTA\_CONFIG, OktaAuthConfigService } from ‘@okta/okta-angular’;  
import { OktaAuthModule,OktaCallbackComponent } from’@okta/okta-angular’;  
import { OktaAuth } from ‘@okta/okta-auth-js’;  
import oicd\_config from ‘./oicd\_config’;

const oktaAuth= new OktaAuth(oicd\_config.oidc);

export const appConfig: ApplicationConfig = {  
providers: [provideRouter(routes), provideClientHydration(), provideHttpClient(),{provide:OKTA\_CONFIG, useValue:{oktaAuth}},  
importProvidersFrom(  
OktaAuthModule  
)],

// authParams là các thông số xác thực bổ sung được truyền vào trong yêu cầu xác thực tới Okta  
//PKCE (Proof Key for Code Exchange) là bảo vệ mã xác thực (authorization code) khỏi việc bị lấy cắp trong quá trình chuyển giao giữa ứng dụng và máy chủ xác thực.  
};

// oidc thường là một phần của cấu hình để sử dụng OpenID Connect (OIDC) để xác thực người dùng.  
app.router.ts  
import { RouterModule, Routes } from ‘@angular/router’;  
import { ProductsListComponent } from ‘./components/products-list/products-list.component’;

import { ProductDetailsComponent } from ‘./components/product-details/product-details.component’;  
import { CartDetailsComponent } from ‘./components/cart-details/cart-details.component’;  
import { CheckoutComponent } from ‘./components/checkout/checkout.component’;  
import { OktaAuthModule,OktaCallbackComponent,OKTA\_CONFIG } from’@okta/okta-angular’;

import { LoginComponent } from ‘./components/login/login.component’;

export const routes: Routes = [  
{path: ‘login/callback’,component:OktaCallbackComponent},  
{path: ‘login’,component:LoginComponent},  
{path: ‘search/:key’,component:ProductsListComponent},  
{path: ‘products/:id’,component:ProductDetailsComponent},  
{path: ‘category/:id’,component:ProductsListComponent},  
{path: ‘category’,component:ProductsListComponent},  
{path: ‘products’,component:ProductsListComponent},  
{path: ‘cart-details’,component:CartDetailsComponent},  
{path: ‘checkout’,component:CheckoutComponent},  
{path: ‘’, redirectTo:‘/products’, pathMatch:‘full’},  
{path: ‘\*\*’,redirectTo:‘/products’, pathMatch:‘full’}  
];  
console.log(window);

export default{  
oidc : {  
clientId: ‘\*\*\*\*\*\*\*\*’,  
issuer: \*\*\*\*\*\*\*\*\*\*',  
redirectUri: ‘[http://localhost:4200/login/callback](http://localhost:4200/login/callback)’,  
pkce: true,

```
    scopes: ['openid', 'profile', 'email'] // Phạm vi truy cập

```

}  
}

 ![Screenshot 2024-04-22 220636](https://global.discourse-cdn.com/oktadev/original/2X/e/e39a441267e2ff83e9d0af7d8526ca941970c1b2.png)

---

<div class="post-metadata">

**Author:** ![andrea](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/andrea/32/2172_2.png) [@andrea](https://devforum.okta.com/u/andrea)\
**Post date:** [April 22, 2024, 3:45pm UTC](https://devforum.okta.com/t/oautherror-the-client-is-not-authorized-to-use-the-provided-grant-type-configured-grant-types/27862/2 "2024-04-22T15:45:48Z")

</div>

Are you using an Okta Identity Engine org? If so, take a look at this article which walks through how to enable Interaction Code flow: [Unauthorized Client Error Using Authorized Grant Type | Okta Help Center](https://support.okta.com/help/s/article/Unauthorized-Client-Error-Using-Authorized-Grant-Type?language=en_US)

---

<div class="post-metadata">

**Author:** ![shirukento1](https://avatars.discourse-cdn.com/v4/letter/s/d2c977/32.png) [@shirukento1](https://devforum.okta.com/u/shirukento1)\
**Post date:** [April 22, 2024, 4:09pm UTC](https://devforum.okta.com/t/oautherror-the-client-is-not-authorized-to-use-the-provided-grant-type-configured-grant-types/27862/3 "2024-04-22T16:09:22Z")

</div>

![Screenshot (490)](https://global.discourse-cdn.com/oktadev/original/2X/a/aa2d7d7ec1b7427547f2fbaeadc00605eddbc3ae.jpeg)

I still get the error. Is there a problem with my config.ts file?

---

<div class="post-metadata">

**Author:** ![alisaduncan](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/alisaduncan/32/3429_2.png) [@alisaduncan](https://devforum.okta.com/u/alisaduncan)\
**Post date:** [April 23, 2024, 5:51pm UTC](https://devforum.okta.com/t/oautherror-the-client-is-not-authorized-to-use-the-provided-grant-type-configured-grant-types/27862/4 "2024-04-23T17:51:09Z")

</div>

Hi there @shirukento1 !

Welcome to the community.

At first glance, I don’t see anything out of place in your snippet of `AppModule` config, but I can’t see the `oktaAuth` instantiation.

I also can’t tell from the screenshot of the policies if your Okta application is configured for an SPA app using authorization code flow, but sometimes the info needed for troubleshooting isn’t appropriate to share on a public forum. 😅

You may want to use our Angular Quickstart to check things out. I included the link to the repo in the response. You can download the code and replace the variables using your issuer and client ID to verify you can sign in. If not, an issue in the Okta application setup needs to be resolved, which may require more detailed conversations depending on your Okta account type.

To double-check Okta settings against a free developer account, you can create a new one by following the instructions in the Angular Quickstart ReadMe.

Let us know how it goes!

> **[GitHub - okta-samples/okta-angular-quickstart: Quickstart sample code for an...](https://github.com/okta-samples/okta-angular-quickstart)**
>
> Quickstart sample code for an Angular app using Okta redirect model - okta-samples/okta-angular-quickstart

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/oktadev/original/1X/589c4c5f80de422d01f47cee7185a7fb8227835c.png) [@system](https://devforum.okta.com/u/system)\
**Post date:** [May 23, 2024, 5:51pm UTC](https://devforum.okta.com/t/oautherror-the-client-is-not-authorized-to-use-the-provided-grant-type-configured-grant-types/27862/5 "2024-05-23T17:51:45Z")

</div>

Closed on May 23, 2024, 5:51pm UTC

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
