# Unable to use PKCE auth when creating a SPA application

**URL:** <https://devforum.okta.com/t/unable-to-use-pkce-auth-when-creating-a-spa-application/15007>\
**Category:** Questions\
**Created:** [July 4, 2021, 3:17pm UTC](https://devforum.okta.com/t/unable-to-use-pkce-auth-when-creating-a-spa-application/15007 "2021-07-04T15:17:49Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![kenzoit](https://avatars.discourse-cdn.com/v4/letter/k/6bbea6/32.png) [@kenzoit](https://devforum.okta.com/u/kenzoit)\
**Post date:** [July 4, 2021, 3:17pm UTC](https://devforum.okta.com/t/unable-to-use-pkce-auth-when-creating-a-spa-application/15007/1 "2021-07-04T15:17:49Z")

</div>

Hi,

I am using the okta sdk for nodejs, to create an SPA application. I would like to use PKCE auth, however even the application type set to SPA, the application is created using client secret by default, instead a PKCE auth. However if I create the application manually from the okta console, the PKCE auth is used by default. And I can’t find anything on the docs explaning this.

Could somebody help me on this?  
This is the request that I am sending to create the application:

const oktaRequestData = {  
‘name’: ‘oidc\_client’,  
‘label’: application.name,  
‘signOnMode’: ‘OPENID\_CONNECT’,  
‘settings’: {  
‘oauthClient’: {  
client\_uri: url,  
logo\_uri,  
‘redirect\_uris’: [  
`https://${applicationId}.${domain}/login/callback`,  
],  
‘wildcard\_redirect’: ‘DISABLED’,  
‘post\_logout\_redirect\_uris’: [  
`https://${applicationId}.${domain}/logout/callback`,  
],  
‘response\_types’: [  
‘code’,  
],  
‘initiate\_login\_uri’: `https://${applicationId}.${domain}/login/callback`,  
‘grant\_types’: [  
‘authorization\_code’,  
‘refresh\_token’,  
],  
‘application\_type’: ‘browser’,  
‘tos\_uri’: `https://${applicationId}.${domain}/client/tos`,  
‘policy\_uri’: `https://${applicationId}.${domain}/client/policy`,  
‘idp\_initiated\_login’: {  
‘mode’: ‘DISABLED’,  
},  
},  
},  
};

---

<div class="post-metadata">

**Author:** ![kenzoit](https://avatars.discourse-cdn.com/v4/letter/k/6bbea6/32.png) [@kenzoit](https://devforum.okta.com/u/kenzoit)\
**Post date:** [July 4, 2021, 5:58pm UTC](https://devforum.okta.com/t/unable-to-use-pkce-auth-when-creating-a-spa-application/15007/2 "2021-07-04T17:58:55Z")

</div>

Found the solution. We need to set “token\_endpoint\_auth\_method”: “none” in order to use PKCE auth.

Question can be closed

---

<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:** [July 6, 2021, 4:13pm UTC](https://devforum.okta.com/t/unable-to-use-pkce-auth-when-creating-a-spa-application/15007/3 "2021-07-06T16:13:02Z")

</div>

Closed on July 6, 2021, 4:13pm UTC

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