Safe Haskell | None |
---|---|
Language | Haskell98 |
Deprecated: Google+ is being shut down, please migrate to Google Sign-in https://pbrisbin.com/posts/googleemail2_deprecation/
Use an email address as an identifier via Google's login system.
Note that this is a replacement for Yesod.Auth.GoogleEmail, which depends on Google's now deprecated OpenID system. For more information, see https://developers.google.com/+/api/auth-migration.
By using this plugin, you are trusting Google to validate an email address, and requiring users to have a Google account. On the plus side, you get to use email addresses as the identifier, many users have existing Google accounts, the login system has been long tested (as opposed to BrowserID), and it requires no credential managing or setup (as opposed to Email).
In order to use this plugin:
- Create an application on the Google Developer Console https://console.developers.google.com/
- Create OAuth credentials. The redirect URI will be http://yourdomain/auth/page/googleemail2/complete. (If you have your authentication subsite at a different root than /auth/, please adjust accordingly.)
- Enable the Google+ API.
Since: 1.3.1
Synopsis
- authGoogleEmail :: YesodAuth m => Text -> Text -> AuthPlugin m
- authGoogleEmailSaveToken :: YesodAuth m => Text -> Text -> AuthPlugin m
- forwardUrl :: AuthRoute
- data Token = Token {
- accessToken :: Text
- tokenType :: Text
- getUserAccessToken :: MonadHandler m => m (Maybe Token)
- getPerson :: MonadHandler m => Manager -> Token -> m (Maybe Person)
- data Person = Person {
- personId :: Text
- personDisplayName :: Maybe Text
- personName :: Maybe Name
- personNickname :: Maybe Text
- personBirthday :: Maybe Text
- personGender :: Maybe Gender
- personProfileUri :: Maybe Text
- personImage :: Maybe PersonImage
- personAboutMe :: Maybe Text
- personRelationshipStatus :: Maybe RelationshipStatus
- personUris :: [PersonURI]
- personOrganizations :: [Organization]
- personPlacesLived :: [Place]
- personTagline :: Maybe Text
- personIsPlusUser :: Maybe Bool
- personBraggingRights :: Maybe Text
- personPlusOneCount :: Maybe Int
- personCircledByCount :: Maybe Int
- personVerified :: Maybe Bool
- personLanguage :: Maybe Text
- personEmails :: [Email]
- personDomain :: Maybe Text
- personOccupation :: Maybe Text
- personSkills :: Maybe Text
- data Name = Name {}
- data Gender
- = Male
- | Female
- | OtherGender
- newtype PersonImage = PersonImage {}
- resizePersonImage :: PersonImage -> Int -> PersonImage
- data RelationshipStatus
- data PersonURI = PersonURI {}
- data PersonURIType
- data Organization = Organization {
- orgName :: Maybe Text
- orgTitle :: Maybe Text
- orgType :: Maybe OrganizationType
- orgStartDate :: Maybe Text
- orgEndDate :: Maybe Text
- orgPrimary :: Maybe Bool
- data OrganizationType
- data Place = Place {
- placeValue :: Maybe Text
- placePrimary :: Maybe Bool
- data Email = Email {
- emailValue :: Text
- emailType :: EmailType
- data EmailType
- pid :: Text
Authentication handlers
:: YesodAuth m | |
=> Text | client ID |
-> Text | client secret |
-> AuthPlugin m |
authGoogleEmailSaveToken Source #
:: YesodAuth m | |
=> Text | client ID |
-> Text | client secret |
-> AuthPlugin m |
An alternative version which stores user access token in the session variable. Use it if you want to request user's profile from your app.
Since: 1.4.3
User authentication token
An authentication token which was acquired from OAuth callback.
The token gets saved into the session storage only if you use
authGoogleEmailSaveToken
.
You can acquire saved token with getUserAccessToken
.
Since: 1.4.3
Token | |
|
getUserAccessToken :: MonadHandler m => m (Maybe Token) Source #
Get user's access token from the session. Returns Nothing if it's not found
(probably because the user is not logged in via GoogleEmail2
or you are not using authGoogleEmailSaveToken
)
Person
getPerson :: MonadHandler m => Manager -> Token -> m (Maybe Person) Source #
Allows to fetch information about a user from Google's API.
In case of parsing error returns Nothing
.
Will throw HttpException
in case of network problems or error response code.
Since: 1.4.3
Information about the user Full description of the resource https://developers.google.com/+/api/latest/people
Since: 1.4.3
Person | |
|
Individual components of a name
Since: 1.4.3
Name | |
|
Gender of the person
Since: 1.4.3
newtype PersonImage Source #
The URI of the person's profile photo.
Since: 1.4.3
Instances
Eq PersonImage Source # | |
Defined in Yesod.Auth.GoogleEmail2 (==) :: PersonImage -> PersonImage -> Bool # (/=) :: PersonImage -> PersonImage -> Bool # | |
Show PersonImage Source # | |
Defined in Yesod.Auth.GoogleEmail2 showsPrec :: Int -> PersonImage -> ShowS # show :: PersonImage -> String # showList :: [PersonImage] -> ShowS # | |
FromJSON PersonImage Source # | |
Defined in Yesod.Auth.GoogleEmail2 parseJSON :: Value -> Parser PersonImage # parseJSONList :: Value -> Parser [PersonImage] # |
resizePersonImage :: PersonImage -> Int -> PersonImage Source #
resizePersonImage img 30
would set query part to ?sz=30
which would resize
the image under the URI. If for some reason you need to modify the query
part, you should do it after resizing.
Since: 1.4.3
data RelationshipStatus Source #
The person's relationship status.
Since: 1.4.3
Single | Person is single |
InRelationship | Person is in a relationship |
Engaged | Person is engaged |
Married | Person is married |
Complicated | The relationship is complicated |
OpenRelationship | Person is in an open relationship |
Widowed | Person is widowed |
DomesticPartnership | Person is in a domestic partnership |
CivilUnion | Person is in a civil union |
RelationshipStatus Text | Something else |
Instances
Eq RelationshipStatus Source # | |
Defined in Yesod.Auth.GoogleEmail2 (==) :: RelationshipStatus -> RelationshipStatus -> Bool # (/=) :: RelationshipStatus -> RelationshipStatus -> Bool # | |
Show RelationshipStatus Source # | |
Defined in Yesod.Auth.GoogleEmail2 showsPrec :: Int -> RelationshipStatus -> ShowS # show :: RelationshipStatus -> String # showList :: [RelationshipStatus] -> ShowS # | |
FromJSON RelationshipStatus Source # | |
Defined in Yesod.Auth.GoogleEmail2 parseJSON :: Value -> Parser RelationshipStatus # parseJSONList :: Value -> Parser [RelationshipStatus] # |
URIs specified in the person's profile
Since: 1.4.3
data PersonURIType Source #
The type of URI
Since: 1.4.3
OtherProfile | URI for another profile |
Contributor | URI to a site for which this person is a contributor |
Website | URI for this Google+ Page's primary website |
OtherURI | Other URL |
PersonURIType Text | Something else |
Instances
Eq PersonURIType Source # | |
Defined in Yesod.Auth.GoogleEmail2 (==) :: PersonURIType -> PersonURIType -> Bool # (/=) :: PersonURIType -> PersonURIType -> Bool # | |
Show PersonURIType Source # | |
Defined in Yesod.Auth.GoogleEmail2 showsPrec :: Int -> PersonURIType -> ShowS # show :: PersonURIType -> String # showList :: [PersonURIType] -> ShowS # | |
FromJSON PersonURIType Source # | |
Defined in Yesod.Auth.GoogleEmail2 parseJSON :: Value -> Parser PersonURIType # parseJSONList :: Value -> Parser [PersonURIType] # |
data Organization Source #
Current or past organizations with which this person is associated
Since: 1.4.3
Organization | |
|
Instances
Eq Organization Source # | |
Defined in Yesod.Auth.GoogleEmail2 (==) :: Organization -> Organization -> Bool # (/=) :: Organization -> Organization -> Bool # | |
Show Organization Source # | |
Defined in Yesod.Auth.GoogleEmail2 showsPrec :: Int -> Organization -> ShowS # show :: Organization -> String # showList :: [Organization] -> ShowS # | |
FromJSON Organization Source # | |
Defined in Yesod.Auth.GoogleEmail2 parseJSON :: Value -> Parser Organization # parseJSONList :: Value -> Parser [Organization] # |
data OrganizationType Source #
The type of an organization
Since: 1.4.3
Work | |
School | |
OrganizationType Text | Something else |
Instances
Eq OrganizationType Source # | |
Defined in Yesod.Auth.GoogleEmail2 (==) :: OrganizationType -> OrganizationType -> Bool # (/=) :: OrganizationType -> OrganizationType -> Bool # | |
Show OrganizationType Source # | |
Defined in Yesod.Auth.GoogleEmail2 showsPrec :: Int -> OrganizationType -> ShowS # show :: OrganizationType -> String # showList :: [OrganizationType] -> ShowS # | |
FromJSON OrganizationType Source # | |
Defined in Yesod.Auth.GoogleEmail2 parseJSON :: Value -> Parser OrganizationType # parseJSONList :: Value -> Parser [OrganizationType] # |
A place where the person has lived or is living at the moment.
Since: 1.4.3
Place | |
|
Person's email
Since: 1.4.3
|
Type of email
Since: 1.4.3
EmailAccount | Google account email address |
EmailHome | Home email address |
EmailWork | Work email adress |
EmailOther | Other email address |
EmailType Text | Something else |