Copyright | (c) 2021 The closed eye of love |
---|---|
License | BSD-3-Clause |
Maintainer | Poscat <poscat@mail.poscat.moe>, berberman <berberman@yandex.com> |
Stability | alpha |
Portability | portable |
Safe Haskell | None |
Language | Haskell2010 |
Web.Pixiv.Auth
Description
Authentication pixiv API. Users should not use logics in this module directly, since Web.Pixiv.Types.PixivT takes over token management, providing user friendly operations.
Synopsis
- newtype Token = Token {}
- newtype Credential = RefreshToken {}
- data OAuth2Token = OAuth2Token {}
- data OAuth2Error = OAuth2Error {
- oa_error :: Errors
- oa_message :: Text
- data OAuth2Result
- data Errors
- auth :: Manager -> Credential -> IO OAuth2Result
- auth' :: Manager -> Credential -> IO OAuth2Token
Documentation
A wrapped Text
represents a token.
newtype Credential Source #
Authentication credentials for pixiv API.
Password authentication is no longer supported by pixiv.
You may consult https://github.com/upbit/pixivpy/issues/158 to get the information of how to acquire refresh token.
Normally, users are supposed to create value of this data type and then pass it to runPixivT
.
Constructors
RefreshToken | |
Fields |
Instances
Eq Credential Source # | |
Defined in Web.Pixiv.Auth | |
Show Credential Source # | |
Defined in Web.Pixiv.Auth Methods showsPrec :: Int -> Credential -> ShowS # show :: Credential -> String # showList :: [Credential] -> ShowS # |
data OAuth2Token Source #
Successful result.
Constructors
OAuth2Token | |
Fields
|
Instances
Eq OAuth2Token Source # | |
Defined in Web.Pixiv.Auth | |
Read OAuth2Token Source # | |
Defined in Web.Pixiv.Auth Methods readsPrec :: Int -> ReadS OAuth2Token # readList :: ReadS [OAuth2Token] # readPrec :: ReadPrec OAuth2Token # readListPrec :: ReadPrec [OAuth2Token] # | |
Show OAuth2Token Source # | |
Defined in Web.Pixiv.Auth Methods showsPrec :: Int -> OAuth2Token -> ShowS # show :: OAuth2Token -> String # showList :: [OAuth2Token] -> ShowS # | |
ToJSON OAuth2Token Source # | |
Defined in Web.Pixiv.Auth Methods toJSON :: OAuth2Token -> Value # toEncoding :: OAuth2Token -> Encoding # toJSONList :: [OAuth2Token] -> Value # toEncodingList :: [OAuth2Token] -> Encoding # | |
FromJSON OAuth2Token Source # | |
Defined in Web.Pixiv.Auth |
data OAuth2Error Source #
Failed result.
Constructors
OAuth2Error | |
Fields
|
Instances
Eq OAuth2Error Source # | |
Defined in Web.Pixiv.Auth | |
Read OAuth2Error Source # | |
Defined in Web.Pixiv.Auth Methods readsPrec :: Int -> ReadS OAuth2Error # readList :: ReadS [OAuth2Error] # readPrec :: ReadPrec OAuth2Error # readListPrec :: ReadPrec [OAuth2Error] # | |
Show OAuth2Error Source # | |
Defined in Web.Pixiv.Auth Methods showsPrec :: Int -> OAuth2Error -> ShowS # show :: OAuth2Error -> String # showList :: [OAuth2Error] -> ShowS # | |
FromJSON OAuth2Error Source # | |
Defined in Web.Pixiv.Auth | |
Exception OAuth2Error Source # | |
Defined in Web.Pixiv.Auth Methods toException :: OAuth2Error -> SomeException # fromException :: SomeException -> Maybe OAuth2Error # displayException :: OAuth2Error -> String # |
data OAuth2Result Source #
Authentication result.
Constructors
AuthSuccess OAuth2Token | |
AuthFailure OAuth2Error |
Instances
Eq OAuth2Result Source # | |
Defined in Web.Pixiv.Auth | |
Show OAuth2Result Source # | |
Defined in Web.Pixiv.Auth Methods showsPrec :: Int -> OAuth2Result -> ShowS # show :: OAuth2Result -> String # showList :: [OAuth2Result] -> ShowS # | |
FromJSON OAuth2Result Source # | |
Defined in Web.Pixiv.Auth |
Authentication failure reasons.
Constructors
InvalidRequest | |
InvalidClient | |
InvalidGrant | |
UnauthorizedClient | |
UnsupportedGrantType | |
InvalidScope |
auth :: Manager -> Credential -> IO OAuth2Result Source #
Given a credential, performs a authentication request.
auth' :: Manager -> Credential -> IO OAuth2Token Source #
Like auth
, but immediately throws OAuth2Error
if auth failed.