Hi everyone I want to call the Django OAuth toolkit's default /auth/token API and get a new token for the user. When I call that API by Postman it is OK and the responses are correct but when I call it with the same information by the DRF APITestCase client it says: "unsupported_grant_type"
Thanks for your help My code is below: def setUp(self): self.client = APIClient() self.client_id = '<ID>' self.client_secret = '<KEY>' self.grant_type = 'client_credentials' self.auth_data = urlencode( {'client_id': self.client_id, 'client_secret': self.client_secret, 'grant_type': self.grant_type} ) def _get_token(self): response = self.client.post( path='/auth/token/', data=self.auth_data, content_type='application/x-www-form-urlencoded', ) token_data = json.loads(response.content) print(token_data) return token_data -- You received this message because you are subscribed to the Google Groups "Django REST framework" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-rest-framework+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-rest-framework/7baea873-dbbc-4f31-8071-ba6f968a0a46n%40googlegroups.com.