python from authomatic import Authomatic from authomatic.providers import oauth2 CONFIG = { 'google': { 'class_': oauth2.Google, 'consumer_key': 'YOUR_CONSUMER_KEY', 'consumer_secret': 'YOUR_CONSUMER_SECRET', 'scope': ['email', 'profile'], }, } authomatic = Authomatic(CONFIG, 'some_secret_string') result = authomatic.login(authomatic.providers['google']) if result: if result.error: print(result.error.message) elif result.user: user = result.user print(user.id, user.name, user.email) else: print('Authentication cancelled.') else: print(result)


上一篇:
下一篇:
切换中文