Reputation: 1192
I am using OAuth client credentials to offer my customers access to our API so they can integrate with their systems.
To register an application and generate a client_id and client_secret the Django-oauth-toolkit documentation says the form o/applications/register/
must be completed (documentation here). Is it possible to automatically issue a client_id and client_secret to my user when they sign up instead of directing them to this form ?
Upvotes: 0
Views: 1669
Reputation: 1540
Here's an example to get the data that you need. All you need to do is to integrate this into your custom user model.
from oauth2_provider.models import get_application_model
Application = get_application_model()
app = Application()
app.name = 'test'
app.client_type = 'confidential'
app.authorization_grant_type = 'password'
app.user_id = 1
app.save()
#client_id:
app.client_id
#client_secret:
app.client_secret
Upvotes: 1