You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In order to provide standards based authentication to the P2PU API, we'll need to implement support for OAuth 2.0. I've started a first cut of this with bd269c9. To test out what is currently there:
Create a client application using the Django console:
fromdjango.contrib.auth.modelsimportUserfromoauth2app.modelsimportClientuser=User.objects.get(...) # get some userclient=Client.objects.create(name='Sample App', user=user, redirect_uri='http://localhost:3000')
# print client credentialsprintclient.keyprintclient.secret
Construct authorization URL and authorize the app.
Approve the app's authorization request and you'll be redirected to the callback URL (it's fine if it 404s) with a code query string parameter. Save that code for the following step.
Exchange authorization code for access token. This is best done with curl:
Security audit. This uses oauth2app which seems fairly popular. We should still make sure we're not introducing any security vulnerabilities by adding this.
Pretty up the Authorization page (templates/oauth/authorize.html).
Implement support for authentication throughout the existing API.
The text was updated successfully, but these errors were encountered:
In order to provide standards based authentication to the P2PU API, we'll need to implement support for OAuth 2.0. I've started a first cut of this with bd269c9. To test out what is currently there:
http://localhost:8000/oauth/authorize?client_id=<from_above>&redirect_uri=http://localhost:3000/callback&response_type=code
curl -X POST http://localhost:3000/oauth/token -d'client_id=from_above' -d'client_secret=from_above' -d'code=from_above' -d'redirect_uri=http://localhost:3000/callback' -d'grant_type=authorization_code'
If successful, the response should be a JSON object with information about the access token.
curl "http://localhost:3000/oauth/test?bearer_token=from_above"
Recommended steps to complete this issue:
The text was updated successfully, but these errors were encountered: