Can't Login, Error: access_denied Unauthorized

Hi,
if anyone can help with this problem, it would be greatly appreciated , thanks in advance :slight_smile:

Problem:
I have the ability get a Token, but not able to log the user in using “/oauth/token”, I receive a “access_denied” error.
I believe I have setup a test user correctly but under the user “Authorized Applications” I am not able to add/select the my Application name, so
assuming this user does not have access and the reason for this error “access_denied”

	I have tried urls "/oauth/token" and "/oauth/ro” with varies grant types per the documentation.


See below a small code snippet showing the logic:

var rParams = "client_id=\(client_id)&client_secret=\(secret)&audience=\(audience)&grant_type=client_credentials"
    
/////////////////////////////
    // STEP 1 - LETS GET THE TOKEN

    self.makeHttpRequest(url: domain + "/oauth/token", params: rParams, cb: { [self] jsonString in
        
        var sJson = self.convertToDictionary(str: jsonString)
      
        accessToken = sJson!["access_token"] as! String
      
         ///////////////////////////
   	    // STEP 2 - WE HAVE THE TOKEN, LETS LOGIN

        // Login User
        rParams = "client_id=\(client_id)&grant_type=password&username=\(userName)&password=\(password)"
       
   
        self.makeHttpRequest(url: self.domain + "/oauth/token", params: rParams, cb: { jsonString in
            
           
	// FAILS HERE WITH:  {"error":"access_denied","error_description":"Unauthorized"}


        })
    })
1 Like

I had the same problem. Did u solve it?