Repository: jazzband/django-oauth-toolkit

Issue:
add some `client-secret` required tips when `python manage.py createapplication` in version >= 2.0.0
**Is your feature request related to a problem? Please describe.**
when i createapplication like before using `python manage.py createapplication --name self-front-end --client-id=self-front-end  confidential password`, than copy client_id and client_secret  use in basic auth, response is "invalid_client".
i debug and find `client_secret ` is use django `check_password` . and need provide source `client_secret ` in `python manage.py createapplication` like `python manage.py createapplication --name self-front-end --client-id=self-front-end --client-secret=123456 confidential password`.

i think it is better add a tip when i createapplication, if not got --client-secret=123456 return a tips.

**Describe the solution you'd like**
when createapplication, if not got --client-secret=123456 return a tips.

@n2ygk 


Discussion:

Resolving patch:
diff --git a/oauth2_provider/management/commands/createapplication.py b/oauth2_provider/management/commands/createapplication.py
--- a/oauth2_provider/management/commands/createapplication.py
+++ b/oauth2_provider/management/commands/createapplication.py
@@ -14,12 +14,13 @@ def add_arguments(self, parser):
         parser.add_argument(
             "client_type",
             type=str,
-            help="The client type, can be confidential or public",
+            help="The client type, one of: %s" % ", ".join([ctype[0] for ctype in Application.CLIENT_TYPES]),
         )
         parser.add_argument(
             "authorization_grant_type",
             type=str,
-            help="The type of authorization grant to be used",
+            help="The type of authorization grant to be used, one of: %s"
+            % ", ".join([gtype[0] for gtype in Application.GRANT_TYPES]),
         )
         parser.add_argument(
             "--client-id",
@@ -54,7 +55,8 @@ def add_arguments(self, parser):
         parser.add_argument(
             "--algorithm",
             type=str,
-            help="The OIDC token signing algorithm for this application (e.g., 'RS256' or 'HS256')",
+            help="The OIDC token signing algorithm for this application, one of: %s"
+            % ", ".join([atype[0] for atype in Application.ALGORITHM_TYPES if atype[0]]),
         )
 
     def handle(self, *args, **options):
@@ -82,5 +84,13 @@ def handle(self, *args, **options):
             )
             self.stdout.write(self.style.ERROR("Please correct the following errors:\n %s" % errors))
         else:
+            cleartext_secret = new_application.client_secret
             new_application.save()
-            self.stdout.write(self.style.SUCCESS("New application created successfully"))
+            # Display the newly-created client_name or id.
+            client_name_or_id = application_data.get("name", new_application.client_id)
+            self.stdout.write(
+                self.style.SUCCESS("New application %s created successfully." % client_name_or_id)
+            )
+            # Print out the cleartext client_secret if it was autogenerated.
+            if "client_secret" not in application_data:
+                self.stdout.write(self.style.SUCCESS("client_secret: %s" % cleartext_secret))


Test patch:
diff --git a/tests/test_commands.py b/tests/test_commands.py
--- a/tests/test_commands.py
+++ b/tests/test_commands.py
@@ -27,7 +27,7 @@ def test_command_creates_application(self):
             stdout=output,
         )
         self.assertEqual(Application.objects.count(), 1)
-        self.assertIn("New application created successfully", output.getvalue())
+        self.assertIn("created successfully", output.getvalue())
 
     def test_missing_required_args(self):
         self.assertEqual(Application.objects.count(), 0)