python
from authomatic import Authomatic
authomatic = Authomatic()
authomatic.providers = {
'google': {
'class_': 'authomatic.providers.oauth2.Google',
'consumer_key': 'YOUR_CONSUMER_KEY',
'consumer_secret': 'YOUR_CONSUMER_SECRET',
}
}
response = authomatic.login(authomatic.providers['google'],
callback='http://example.com/auth/google/callback')
if response:
if response.user:
user = response.user
print('User: ', user.name)
print('Email: ', user.email)
elif response.error:
print('Error: ', response.error)
else:
return response