简体   繁体   中英

How to restrict the login google api with specific domain name only?

I'm creating a web application which I'm using Google API for authentication. Also, the library that I've applied was . Then, my goal is to allow only specific domain name like with a domain of . 的域。

Upon reading its documentation this line of code should be added to however, it is not working to me. 但是,它对我不起作用。

configuration 配置

AUTHENTICATION_BACKENDS = (
    'social_core.backends.google.GoogleOAuth2',
    'django.contrib.auth.backends.ModelBackend',
)
SOCIAL_AUTH_GOOGLE_OAUTH2_WHITELISTED_DOMAINS = ['example.com.hk']

How can I restrict the google api to only allow the specified whitelisted domains?

您必须向Google API凭据添加并指定授权域。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM