# Facing issues in getting token via authorization code

**URL:** <https://community.auth0.com/t/facing-issues-in-getting-token-via-authorization-code/103995>\
**Category:** Get Help\
**Tags:** grants, management-api\
**Created:** [April 3, 2023, 8:27am UTC](https://community.auth0.com/t/facing-issues-in-getting-token-via-authorization-code/103995 "2023-04-03T08:27:20Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![surya.chandrasekhara](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@surya.chandrasekhara](https://community.auth0.com/u/surya.chandrasekhara)\
**Post date:** [April 3, 2023, 8:27am UTC](https://community.auth0.com/t/facing-issues-in-getting-token-via-authorization-code/103995/1 "2023-04-03T08:27:20Z")

</div>

Hi Team,

Im facing an issue in having an access tokens.  
I was able to make authorize call successfully and got the code.  
With the same I’m trying to get the token, it is giving CORS error.

Im new to OKTA, any help will be very much appreciated.  
Thanks in advance

My application is a single page application working in angular js.  
Below is the similar code im using in my application

```
		var data = {
				        grant_type: 'authorization_code',				     
        				redirect_uri : 'http://localhost:8080/mfa/callback',            				
        				code: $scope.code,
        				client_id :"myclientId"
					}
					
	    var httpRequest;
	    var tokenURL = 'http://mydomain.com/oauth/token';
	    
	    httpRequest = $http.post(tokenURL, $.param(data), {
				        headers: {
					        'Content-Type': 'application/x-www-form-urlencoded',
					        'Accept': 'application/json',
					        'Access-Control-Allow-Origin' : '*'
				        }
			        });   
		var res = httpRequest.then(

	        function(response) {
			 	// Handle response
			});

```

---

<div class="post-metadata">

**Author:** ![dan.woda](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dan.woda/32/18340_2.png) [@dan.woda](https://community.auth0.com/u/dan.woda)\
**Post date:** [April 4, 2023, 6:32pm UTC](https://community.auth0.com/t/facing-issues-in-getting-token-via-authorization-code/103995/3 "2023-04-04T18:32:00Z")

</div>

Hi @surya.chandrasekhara,

Welcome to the Auth0 Community!

I would recommend using the [Auth0 Angular SDK Quickstarts: Login](https://auth0.com/docs/quickstart/spa/angular/01-login) to work with your app. It should help simplify the process and obfuscate this issue.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [June 22, 2023, 6:38pm UTC](https://community.auth0.com/t/facing-issues-in-getting-token-via-authorization-code/103995/4 "2023-06-22T18:38:22Z")

</div>

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