Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions loginpass/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
from .vk import VK
from .orcid import ORCiD
from .hydra import create_hydra_backend
from .mailru import MailRu


__all__ = [
Expand Down Expand Up @@ -52,6 +53,7 @@
'VK',
'ORCiD',
'create_hydra_backend',
'MailRu',
]

__version__ = version
Expand Down
38 changes: 38 additions & 0 deletions loginpass/mailru.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
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,
'authorize_params ':
{
'scope': 'userinfo'
},
'request_token_params':
{
'scope': 'userinfo'
},
'client_kwargs': {'scope': 'userinfo', 'token_placement': 'uri',}
}


2 changes: 1 addition & 1 deletion loginpass/vk.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'
)


Expand Down