# Okta-auth-js-pkce-example

**URL:** <https://devforum.okta.com/t/okta-auth-js-pkce-example/15411>\
**Category:** Questions\
**Created:** [August 5, 2021, 2:19pm UTC](https://devforum.okta.com/t/okta-auth-js-pkce-example/15411 "2021-08-05T14:19:16Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![spatial](https://avatars.discourse-cdn.com/v4/letter/s/7993a0/32.png) [@spatial](https://devforum.okta.com/u/spatial)\
**Post date:** [August 5, 2021, 2:19pm UTC](https://devforum.okta.com/t/okta-auth-js-pkce-example/15411/1 "2021-08-05T14:19:16Z")

</div>

Hi,  
I follow the instructions.

Not sure at what stage it is wrongly configured. But the client id and issuer url does not seem to be used by auth/index.js( npm trace at the end here )

When I click either ‘implicit profile’ or ‘pkce profile’ I see HTTP 400

**CLI:**

:\okta\>okta apps create  
Application name [okta]: amplify  
Type of Application  
(The Okta CLI only supports a subset of application types and properties):

> 1: Web  
> 2: Single Page App  
> 3: Native App (mobile)  
> 4: Service (Machine-to-Machine)  
> Enter your choice [Web]: 2  
> Redirect URI  
> Common defaults:  
> /callback - [//localhost:8080/callback](https://localhost:8080/callback)  
> Enter your Redirect URI  
> Enter your Post Logout Redirect URI  
> Configuring a new OIDC Application, almost done:  
> Created OIDC application, client-id: 0oa1ev0doczAdwBDj5d7  
> |  
> Okta application configuration:  
> Issuer: [https://dev-1018733.okta.com/oauth2/default](https://dev-1018733.okta.com/oauth2/default)  
> Client ID: 0oa1ev0doczAdwBDj5d7  
> import OktaAuth from ‘@okta/okta-auth-js’;  
> import router from ‘…/router’;

**auth/index.js**

const ISSUER = ‘[https://dev-1018733.okta.com/oauth2/default](https://dev-1018733.okta.com/oauth2/default)’  
const CLIENT\_ID = ‘0oa1ev0doczAdwBDj5d7’  
const REDIRECT\_URL = window.location.origin + ‘/authorization-code/callback’;

const AUTH\_CODE\_GRANT\_TYPE = ‘authorization\_code’;  
const IMPLICIT\_GRANT\_TYPE = ‘implicit’;

**npm**

D:\oktaui\okta-auth-js-pkce-example\>npm run serve

> okta-auth-js-pkce@0.1.0 serve D:\oktaui\okta-auth-js-pkce-example  
> vue-cli-service serve

…building…  
Client ID: undefined  
Okta Org Url: undefined  
INFO Starting development server…  
40% building 123/124 modules 1 active …-auth-js-pkce-example\src\auth\index.jsBrowserslist: caniuse-lite is outdated. Please run next command `npm update` 98% after emitting CopyPlugin

DONE Compiled successfully in 4761ms 7:39:59 PM

App running at:

- Local: [http://localhost:8080/](http://localhost:8080/)
- Network: unavailable

Note that the development build is not optimized.  
To create a production build, run npm run build.  
Thanks,  
Mohan

---

<div class="post-metadata">

**Author:** ![erik](https://avatars.discourse-cdn.com/v4/letter/e/b5ac83/32.png) [@erik](https://devforum.okta.com/u/erik)\
**Post date:** [August 9, 2021, 3:17pm UTC](https://devforum.okta.com/t/okta-auth-js-pkce-example/15411/2 "2021-08-09T15:17:40Z")

</div>

Hi Mohan,  
What version of the Okta CLI are you using,

```auto
okta --version 
0.8.0-a890123

```

`okta apps create` will create an app within Okta, but will not download / setup a local application.  
`okta start` will both create an app within Okta and download a sample application preconfigured for the app created in Okta.

With your sample I am not sure were the okta-auth-js-pkce-example comes from. Is this your own application, or do you have an older version of the Okta CLI?

---

<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:** [February 8, 2024, 6:53pm UTC](https://devforum.okta.com/t/okta-auth-js-pkce-example/15411/3 "2024-02-08T18:53:57Z")

</div>

Closed on February 8, 2024, 6:53pm UTC


