Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Building the authentication page (Django REST Framework) and adding all its functionality #7

Open
1 task
Tracked by #2
alexgarel opened this issue Jun 8, 2022 · 3 comments
Open
1 task
Tracked by #2
Assignees
Labels

Comments

@alexgarel
Copy link
Member

alexgarel commented Jun 8, 2022

What

  • Implement user authentication through open food facts cookie:
  • when the user comes to the portal, and is not yet authenticated:
    • if he does not have OFF cookie → tell him to go authenticate on OFF portal and come back
    • if he does have a cookie, get the user id
      • if the user id is not in the database, create it
      • authenticate the user (custom authentication method)

Part of

@alexgarel
Copy link
Member Author

alexgarel commented Jun 15, 2022

Maybe blocked by openfoodfacts/openfoodfacts-server#6462 (priority on @alexgarel)

To test it locally: edit your /etc/hosts (or equivalent windows) to have community.openfoodfacts.net point to 127.0.0.1, then use this address in your browser to test.
If not possible on windows, ask Stephane, to add a test-community.openfoodfacts.net in our DNS pointing to 127.0.0.1.

@stephanegigandet
Copy link

@sumit-158 : To check if the user is authentified, call https://world.openfoodfacts.org/cgi/session.pl?jqm=1 with the session cookie.

If the user is identified, you will get a response like this one:

{
name: "Stéphane Gigandet",
user_id: "stephane"
}

@teolemon teolemon added the auth label Jun 22, 2022
@M123-dev
Copy link
Member

If there isn't a cookie we can use the wrapper around login from off-dart but we would still have to somehow write the cookie

@teolemon teolemon changed the title Building the authentication page (Rest framework) and adding all its functionality Building the authentication page (Django REST Framework) and adding all its functionality Jul 1, 2022
@alexgarel alexgarel moved this from Todo to Pending in Community federation portal Jul 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Development

No branches or pull requests

5 participants