Code Monkey home page Code Monkey logo

django-social-provider-and-consumer-tutorial's Issues

PKCE not working (since never implemented)

Turns out, when I used PKCE_REQUIRED=True, nothing happened because I didn't add that to the OAUTH2_PROVIDER dictionary which is where django oauth toolkit gets their settings from. I just assumed allauth took care of it (even though I was pretty skeptical). Anyways, finally it showed its true colors so I'll be implementing that now.

This is the code that requires PKCE: https://github.com/oauthlib/oauthlib/blob/master/oauthlib/oauth2/rfc6749/grant_types/authorization_code.py#L19

This is an article that can help: https://www.liip.ch/en/blog/authorization-code-with-pkce-on-django-using-django-oauth-toolkit

Mobile auth tutorial might be wrong

Upon further inspection, it seems like what should instead happen is not have redirect uri for any social consumer on native apps. Instead, if you need to add a "Login with Velnota" button, it should first go to your website which performs the redirect where the user logs in. Then the callback is given to the consumer which then performs the redirect uri on the app...

Custom redirect URI scheme for mobile consumer not necessary for custom

Turns out, the redirect scheme for the mobile app can be https and is recommended in rfc8252: https://datatracker.ietf.org/doc/html/rfc8252#section-7.1

Basically, that custom scheme is only useful for private redirect Uris. It's not particularly helpful if you create an OAuth provider that allows for anyone to register an application because in that case you'll have to keep updating the redirect uri scheme with every new application (or override the django oauth toolkit Application to allow all redirect Uris which in this case isn't necessary).

When you take a look at section 7.2, it explicitly says:

App-claimed "https" scheme redirect URIs have some advantages
compared to other native app redirect options in that the identity of
the destination app is guaranteed to the authorization server by the
operating system. For this reason, native apps SHOULD use them over
the other options where possible.

And in section 8.4:

For private-use URI scheme-based redirects, authorization servers
SHOULD enforce the requirement in Section 7.1 that clients use
schemes that are reverse domain name based. At a minimum, any
private-use URI scheme that doesn't contain a period character (".")
SHOULD be rejected.

In addition to the collision-resistant properties, requiring a URI
scheme based on a domain name that is under the control of the app
can help to prove ownership in the event of a dispute where two apps
claim the same private-use URI scheme (where one app is acting
maliciously). For example, if two apps claimed "com.example.app",
the owner of "example.com" could petition the app store operator to
remove the counterfeit app. Such a petition is harder to prove if a
generic URI scheme was used.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.