Facing issues in getting token via authorization code

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
			});

Hi @surya.chandrasekhara,

Welcome to the Auth0 Community!

I would recommend using the Auth0 Angular SDK Quickstarts: Login to work with your app. It should help simplify the process and obfuscate this issue.

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