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

Refactor Social Login Keys to non - single DocType #4496

Closed
9 tasks done
revant opened this issue Nov 15, 2017 · 2 comments
Closed
9 tasks done

Refactor Social Login Keys to non - single DocType #4496

revant opened this issue Nov 15, 2017 · 2 comments
Assignees

Comments

@revant
Copy link
Collaborator

revant commented Nov 15, 2017

Currently, there are social login keys for Google, Github, Facebook and Frappe. Adding more like Microsoft, Twitter, SalesForce etc can only be done by developer. With this refactor users can add their own providers.

After refactor

  • Package famous providers as fixtures with frappe
  • Various Integrations need to store Client ID / Client Secret Data. e.g. GSuite Settings are stored separately.
  • All these integrations can have a common reusable doctype to store common data / custom and fields

To Do

  • DocType Social Login Key
  • Separate Provider DocType with Fixtures for Google, Github, Facebook and Frappe as Social Login Key dt
  • fields:
  • social login check. If not checked, login via provider button hidden.
  • icontag fontawesome icon to identify provider
  • check utils/oauth.py it has hardcoded providers in get_oauth2_providers() primary thing to refactor
  • Refer the dict below for additional oauth 2 related fields used in utils.oauth.get_oauth2_providers()
"name": "google",
"authorize_url": "https://accounts.google.com/o/oauth2/auth",
"access_token_url": "https://accounts.google.com/o/oauth2/token",
"base_url": "https://www.googleapis.com",
"redirect_uri": "/api/method/frappe.www.login.login_via_google",
"auth_url_data": {
	"display": "page",
	"scope": "https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email",
	"response_type": "code"
},
# relative to base_url
"api_endpoint": "oauth2/v2/userinfo"
"api_endpoint_args": {
	"fields": "first_name,last_name,email,gender,location,verified,picture"
}
user = data["email"] 
  • Right now there are fields on User DocType for github, google, frappe, facebook. On creation of Provider, add a custom field on user (can be done progamatically, cannot be done via ui)?
  • Patch to move existing single to new DocType
@eleben
Copy link

eleben commented Nov 17, 2017

I will gladly do any testing for a Microsoft provider setup :)

@revant revant self-assigned this Nov 18, 2017
@revant
Copy link
Collaborator Author

revant commented Nov 21, 2017

#4519 continue discussion here

netchampfaris pushed a commit that referenced this issue Jan 3, 2018
* Added DocType Social Login Key

WIP for #4496
added basic fields
after_insert add provider_username and provider_userid fields on User dt
on_trash deletes added fields on User dt

* Added field to store fontawesome icon for provider

* [Patch] Social Login Keys to Social Login Key

* [Patch] Social Login Keys to Social Login Key

* Social Login Key generates boilerplate

* patch fixed for social_login_refactor

* removed patch-not working

* use social login keys to initiate flow

* Login page shows Social Login Key

* show login via if base_url present

* removed boilerplate generator

* Multiple Changes

fix zxcvbn import in password_strength.py
use of child table instead of additional fields on user dt to store username and userid

* Fetched Template on Client JS

* Frappe social login template working

* Added Social Login Key Templates

* Codacy fixes and validate social login key urls

* [Patch] Social Login Keys (untested)

* [Fix] Patch refactor social login keys

* [Fix] Patch refactor_social_login_keys manually tested

* Refactor OAuth 2.0 related changes for Social Login Key

* [Fix] Patch refactor social login keys

* Test - Adding Frappe Social Login Key

* Social Login Key Tests

check added child table entry on user for provider frappe
it also checks if userid is created

* [WIP] Office 365 Social Login Key Template

* [Fix] Social Login - Redirect URL

* [Test] Single sign-on icons for added provider

* [Fix] Codacy Errors

* [Fix] Social Login Key Form JS

* Docs Added for Social Login Key

* [Fix] Patch Refactor Social Login Keys

* Handle different icon types

Handle different icon types (image, icon, emoji) with just icon field

* Move the login methods to a new py file

frappe.integrations.oauth2_logins added
copied whitelisted guest oauth2 redirect endpoints from login.py
removing the functions from login.py will break backward compatibility

* Social Login Key Form Changes

Moved Enable field to top
Fields which are not editable are collapsed

* [Fix] Codacy Errors

* Corrected Docs, sync.py

* [Docs] Adding a social login provider

* [Fix] set frappe userid from User Social Login

* [Fix] frappe userid in oauth.py

* removed icon_type

* Use frappe.utils.is_image
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 29, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants