From c565af450a0a61269b844f419061dd9cd2b4db86 Mon Sep 17 00:00:00 2001 From: kuzojman Date: Sat, 27 Nov 2021 23:34:55 +0300 Subject: [PATCH 1/5] change vk api version --- loginpass/vk.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/loginpass/vk.py b/loginpass/vk.py index 2a5ae12..4490470 100644 --- a/loginpass/vk.py +++ b/loginpass/vk.py @@ -19,7 +19,7 @@ USERINFO_ENDPOINT = ( 'users.get?fields=sex,bdate,has_photo,photo_max_orig,site,screen_name' - '&v=5.80' + '&v=5.131' ) From 16458e85d27f7378155c9f7be7b63d65178de65e Mon Sep 17 00:00:00 2001 From: kuzojman Date: Mon, 27 Dec 2021 00:54:05 +0300 Subject: [PATCH 2/5] create mailru --- loginpass/mailru.py | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 loginpass/mailru.py diff --git a/loginpass/mailru.py b/loginpass/mailru.py new file mode 100644 index 0000000..61baec9 --- /dev/null +++ b/loginpass/mailru.py @@ -0,0 +1,42 @@ + +''' +{"birthday": "20.12.1985", "client_id": "eb986c7d5ed6403888f9f21fbc61472e", "email": "vladimir.kuzovkin@bk.ru", + "first_name": "\u0412\u043b\u0430\u0434\u0438\u043c\u0438\u0440", "gender": "m", "id": "566178036", + "image": "https://filin.mail.ru/pic?d=0X8q6bJrl-rjR88OIE5UuCjmcVX-RaQr8TET95nPRQR8xgSC_oNyfVQUjaRxSKVrHGukgZc~&width=180&height=180", + "last_name": "\u041a\u0443\u0437\u043e\u0432\u043a\u0438\u043d", "locale": "ru_RU", + "name": "\u0412\u043b\u0430\u0434\u0438\u043c\u0438\u0440 \u041a\u0443\u0437\u043e\u0432\u043a\u0438\u043d", + "nickname": "\u0412\u043b\u0430\u0434\u0438\u043c\u0438\u0440 \u041a\u0443\u0437\u043e\u0432\u043a\u0438\u043d"} +''' + + +from ._core import map_profile_fields + +def normalize_userinfo(client, data): + return map_profile_fields(data, + { + 'sub': 'id', + 'email' : 'email', + 'name': 'nickname', + 'given_name': 'first_name', + 'family_name': 'last_name', + 'preferred_username': 'name', + 'picture': "image", + 'gender': 'gender', + 'birthdate': 'birthday' + }) + + + +class MailRu(object): + NAME = 'mailru' + OAUTH_CONFIG = { + 'api_base_url': 'https://oauth.mail.ru/', + 'access_token_url': 'https://oauth.mail.ru/token', + 'authorize_url': 'https://oauth.mail.ru/login', + 'userinfo_endpoint': 'https://oauth.mail.ru/userinfo', + 'userinfo_compliance_fix': normalize_userinfo, + } + + + + From eeb6d40be9c52c8c85d835214370995c28b444bc Mon Sep 17 00:00:00 2001 From: kuzojman Date: Mon, 27 Dec 2021 00:57:23 +0300 Subject: [PATCH 3/5] update init with adding mailru --- loginpass/__init__.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/loginpass/__init__.py b/loginpass/__init__.py index e8f63a7..649086d 100644 --- a/loginpass/__init__.py +++ b/loginpass/__init__.py @@ -24,6 +24,7 @@ from .vk import VK from .orcid import ORCiD from .hydra import create_hydra_backend +from .mailru import MailRu __all__ = [ @@ -52,6 +53,7 @@ 'VK', 'ORCiD', 'create_hydra_backend', + 'MailRu', ] __version__ = version From 875c3af2542b0dcc8406ec81fada0b5720f1811e Mon Sep 17 00:00:00 2001 From: kuzojman Date: Mon, 27 Dec 2021 02:44:26 +0300 Subject: [PATCH 4/5] update mailru --- loginpass/mailru.py | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/loginpass/mailru.py b/loginpass/mailru.py index 61baec9..7e12dfa 100644 --- a/loginpass/mailru.py +++ b/loginpass/mailru.py @@ -1,14 +1,3 @@ - -''' -{"birthday": "20.12.1985", "client_id": "eb986c7d5ed6403888f9f21fbc61472e", "email": "vladimir.kuzovkin@bk.ru", - "first_name": "\u0412\u043b\u0430\u0434\u0438\u043c\u0438\u0440", "gender": "m", "id": "566178036", - "image": "https://filin.mail.ru/pic?d=0X8q6bJrl-rjR88OIE5UuCjmcVX-RaQr8TET95nPRQR8xgSC_oNyfVQUjaRxSKVrHGukgZc~&width=180&height=180", - "last_name": "\u041a\u0443\u0437\u043e\u0432\u043a\u0438\u043d", "locale": "ru_RU", - "name": "\u0412\u043b\u0430\u0434\u0438\u043c\u0438\u0440 \u041a\u0443\u0437\u043e\u0432\u043a\u0438\u043d", - "nickname": "\u0412\u043b\u0430\u0434\u0438\u043c\u0438\u0440 \u041a\u0443\u0437\u043e\u0432\u043a\u0438\u043d"} -''' - - from ._core import map_profile_fields def normalize_userinfo(client, data): @@ -35,8 +24,15 @@ class MailRu(object): 'authorize_url': 'https://oauth.mail.ru/login', 'userinfo_endpoint': 'https://oauth.mail.ru/userinfo', 'userinfo_compliance_fix': normalize_userinfo, + 'authorize_params ': + { + 'scope': 'userinfo' + }, + 'request_token_params': + { + 'scope': 'userinfo' + }, + 'client_kwargs': {'scope': 'userinfo', 'token_placement': 'uri',} } - - From 5d851d900a0713415bed5c79ba7c54cf2f63c4e1 Mon Sep 17 00:00:00 2001 From: kuzojman Date: Mon, 27 Dec 2021 02:56:19 +0300 Subject: [PATCH 5/5] update readme --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 3b10116..145bc1f 100644 --- a/README.md +++ b/README.md @@ -77,6 +77,7 @@ Connections that Authlib Loginpass contains: - [x] Yandex - [x] Twitch - [x] VK +- [x] Mail.ru - [x] [Ory Hydra](https://www.ory.sh/docs/hydra/) Usage