Search code examples
python-3.xdjangooauth-2.0oauthdjango-oauth-toolkit

Which Authorization Grant to use for Django Oauth2 toolkit?


I am planning to deploy a separate resource server and an authorisation server, both running on django oauth toolkit. Assuming that the clients or the applications using our API services are in the same organization, and will host their frontend to use our APIs, and the users will be logged in on their side and we just have to authorize those clients (that are running the application).

Which Grant Type Should I use?


Solution

  • RFC 7636: Proof Key for Code Exchange

    PKCE (RFC 7636) is an extension to the Authorization Code flow to prevent CSRF and authorization code injection attacks.

    PKCE is not a replacement for a client secret, and PKCE is recommended even if a client is using a client secret.

    Note: Because PKCE is not a replacement for client authentication, it does not allow treating a public client as a confidential client.

    PKCE was originally designed to protect the authorization code flow in mobile apps, but its ability to prevent authorization code injection makes it useful for every type of OAuth client, even web apps that use a client secret.