[{"name":"OAuth","comment":" Utility library to manage client-side OAuth 2.0 authentications\n\nThe library contains a main OAuth module exposing types used accross other modules. In practice,\nyou'll only need tu use one of the additional modules:\n\n  - OAuth.AuthorizationCode: The authorization code grant type is used to obtain both access tokens\n    and refresh tokens via a redirection-based flow and is optimized for confidential clients\n    [4.1](https://tools.ietf.org/html/rfc6749#section-4.1).\n\n  - OAuth.Implicit: The implicit grant type is used to obtain access tokens (it does not support the\n    issuance of refresh tokens) and is optimized for public clients known to operate a particular\n    redirection URI [4.2](https://tools.ietf.org/html/rfc6749#section-4.2).\n\n  - OAuth.Password: The resource owner password credentials grant type is suitable in cases where the\n    resource owner has a trust relationship with the client, such as the device operating system or a\n    highly privileged application [4.3](https://tools.ietf.org/html/rfc6749#section-4.3)\n\n  - OAuth.ClientCredentials: The client can request an access token using only its client credentials\n    (or other supported means of authentication) when the client is requesting access to the protected\n    resources under its control, or those of another resource owner that have been previously arranged\n    with the authorization server (the method of which is beyond the scope of this specification)\n    [4.4](https://tools.ietf.org/html/rfc6749#section-4.3).\n\nIn practice, you most probably want to use the _OAuth.Implicit_ module which is the most commonly\nused.\n\n\n## Token\n\n@docs Token, useToken, tokenToString, tokenFromString\n\n\n## ErrorCode\n\n@docs ErrorCode, errorCodeToString, errorCodeFromString\n\n\n## Decoders & Parsers Utils (advanced)\n\n@docs TokenType, TokenString, makeToken, makeRefreshToken\n\n","unions":[{"name":"ErrorCode","comment":" Describes an OAuth error response [4.1.2.1](https://tools.ietf.org/html/rfc6749#section-4.1.2.1)\n\n  - InvalidRequest: The request is missing a required parameter, includes an invalid parameter value,\n    includes a parameter more than once, or is otherwise malformed.\n\n  - UnauthorizedClient: The client is not authorized to request an authorization code using this\n    method.\n\n  - AccessDenied: The resource owner or authorization server denied the request.\n\n  - UnsupportedResponseType: The authorization server does not support obtaining an authorization code\n    using this method.\n\n  - InvalidScope: The requested scope is invalid, unknown, or malformed.\n\n  - ServerError: The authorization server encountered an unexpected condition that prevented it from\n    fulfilling the request. (This error code is needed because a 500 Internal Server Error HTTP status\n    code cannot be returned to the client via an HTTP redirect.)\n\n  - TemporarilyUnavailable: The authorization server is currently unable to handle the request due to\n    a temporary overloading or maintenance of the server. (This error code is needed because a 503\n    Service Unavailable HTTP status code cannot be returned to the client via an HTTP redirect.)\n\n  - Custom: Encountered a 'free-string' or custom code not specified by the official RFC but returned\n    by the authorization server.\n\n","args":[],"cases":[["InvalidRequest",[]],["UnauthorizedClient",[]],["AccessDenied",[]],["UnsupportedResponseType",[]],["InvalidScope",[]],["ServerError",[]],["TemporarilyUnavailable",[]],["Custom",["String.String"]]]},{"name":"Token","comment":" Describes the type of access token to use.\n\n  - Bearer: Utilized by simply including the access token string in the request\n    [rfc6750](https://tools.ietf.org/html/rfc6750)\n\n  - Mac: Not yet supported.\n\n","args":[],"cases":[]}],"aliases":[{"name":"TokenString","comment":" Alias for readability\n","args":[],"type":"String.String"},{"name":"TokenType","comment":" Alias for readability\n","args":[],"type":"String.String"}],"values":[{"name":"errorCodeFromString","comment":" Builds a string back into an error code. Returns 'Custom \\_'\nwhen the string isn't recognized from the ones specified in the RFC\n","type":"String.String -> OAuth.ErrorCode"},{"name":"errorCodeToString","comment":" Gets the `String` representation of an `ErrorCode`.\n","type":"OAuth.ErrorCode -> String.String"},{"name":"makeRefreshToken","comment":" See 'makeToken', with the subtle difference that a token value may or\nmay not be there. returns 'Nothing' when the token type isn't \"Bearer\", and\n'Just Nothing' or 'Just (Just token)' otherwise, depending on whether a token is\npresent or not.\n","type":"OAuth.TokenType -> Maybe.Maybe OAuth.TokenString -> Maybe.Maybe (Maybe.Maybe OAuth.Token)"},{"name":"makeToken","comment":" Create a token from two string representing a token type and\nan actual token value. This is intended to be used in Json decoders\nor Query parsers. Returns 'Nothing' when the token type is Nothing\n, different from Just \"Bearer\" or when there's no token at all.\n","type":"Maybe.Maybe OAuth.TokenType -> Maybe.Maybe OAuth.TokenString -> Maybe.Maybe OAuth.Token"},{"name":"tokenFromString","comment":" Parse a token from an 'Authorization' header string.\n\n      tokenFromString (tokenToString token) == Just token\n\n","type":"String.String -> Maybe.Maybe OAuth.Token"},{"name":"tokenToString","comment":" Gets the `String` representation of a `Token` to be used in an 'Authorization' header\n","type":"OAuth.Token -> String.String"},{"name":"useToken","comment":" Use a token to authenticate a request.\n","type":"OAuth.Token -> List.List Http.Header -> List.List Http.Header"}],"binops":[]},{"name":"OAuth.AuthorizationCode","comment":" The authorization code grant type is used to obtain both access\ntokens and refresh tokens and is optimized for confidential clients.\nSince this is a redirection-based flow, the client must be capable of\ninteracting with the resource owner's user-agent (typically a web\nbrowser) and capable of receiving incoming requests (via redirection)\nfrom the authorization server.\n\nThis is a 3-step process:\n\n  - The client asks for an authorization to the OAuth provider: the user is redirected.\n  - The provider redirects the user back and the client parses the request query parameters from the url.\n  - The client authenticate itself using the authorization code found in the previous step.\n\nAfter those steps, the client owns an `access_token` that can be used to authorize any subsequent\nrequest.\n\n\n## Authorize\n\n@docs Authorization, AuthorizationResult, AuthorizationSuccess, AuthorizationError, parseCode, makeAuthUrl\n\n\n## Authorize (advanced)\n\n@docs parseCodeWith\n\n\n## Authenticate\n\n@docs Authentication, Credentials, AuthenticationSuccess, AuthenticationError, RequestParts, makeTokenRequest\n\n\n## Query Parsers\n\n@docs Parsers, defaultParsers, defaultCodeParser, defaultErrorParser, defaultAuthorizationSuccessParser, defaultAuthorizationErrorParser\n\n\n## Json Decoders\n\n@docs defaultAuthenticationSuccessDecoder, defaultAuthenticationErrorDecoder, defaultExpiresInDecoder, defaultScopeDecoder, lenientScopeDecoder, defaultTokenDecoder, defaultRefreshTokenDecoder, defaultErrorDecoder, defaultErrorDescriptionDecoder, defaultErrorUriDecoder\n\n","unions":[{"name":"AuthorizationResult","comment":" Describes errors coming from attempting to parse a url after an OAuth redirection\n\n  - Empty: means there were nothing (related to OAuth 2.0) to parse\n  - Error: a successfully parsed OAuth 2.0 error\n  - Success: a successfully parsed the response\n\n","args":[],"cases":[["Empty",[]],["Error",["OAuth.AuthorizationCode.AuthorizationError"]],["Success",["OAuth.AuthorizationCode.AuthorizationSuccess"]]]}],"aliases":[{"name":"Authentication","comment":" Request configuration for an AuthorizationCode authentication\n\n    let authentication =\n          { credentials =\n              -- Only the clientId is required. Specify a secret\n              -- if a Basic OAuth is required by the resource\n              -- provider\n              { clientId = \"<my-client-id>\"\n              , secret = Nothing\n              }\n          -- Authorization code from the authorization result\n          , code = \"<authorization-code>\"\n          -- Token endpoint of the resource provider\n          , url = \"<token-endpoint>\"\n          -- Redirect Uri to your webserver\n          , redirectUri = \"<my-web-server>\"\n          }\n\n","args":[],"type":"{ credentials : OAuth.AuthorizationCode.Credentials, code : String.String, redirectUri : Url.Url, url : Url.Url }"},{"name":"AuthenticationError","comment":" Describes an OAuth error as a result of a request failure\n\n  - error (_REQUIRED_):\n    A single ASCII error code.\n\n  - errorDescription (_OPTIONAL_)\n    Human-readable ASCII text providing additional information, used to assist the client developer in\n    understanding the error that occurred. Values for the `errorDescription` parameter MUST NOT\n    include characters outside the set `%x20-21 / %x23-5B / %x5D-7E`.\n\n  - errorUri (_OPTIONAL_):\n    A URI identifying a human-readable web page with information about the error, used to\n    provide the client developer with additional information about the error. Values for the\n    `errorUri` parameter MUST conform to the URI-reference syntax and thus MUST NOT include\n    characters outside the set `%x21 / %x23-5B / %x5D-7E`.\n\n","args":[],"type":"{ error : OAuth.ErrorCode, errorDescription : Maybe.Maybe String.String, errorUri : Maybe.Maybe String.String }"},{"name":"AuthenticationSuccess","comment":" The response obtained as a result of an authentication (implicit or not)\n\n  - token (_REQUIRED_):\n    The access token issued by the authorization server.\n\n  - refreshToken (_OPTIONAL_):\n    The refresh token, which can be used to obtain new access tokens using the same authorization\n    grant as described in [Section 6](https://tools.ietf.org/html/rfc6749#section-6).\n\n  - expiresIn (_RECOMMENDED_):\n    The lifetime in seconds of the access token. For example, the value \"3600\" denotes that the\n    access token will expire in one hour from the time the response was generated. If omitted, the\n    authorization server SHOULD provide the expiration time via other means or document the default\n    value.\n\n  - scope (_OPTIONAL, if identical to the scope requested; otherwise, REQUIRED_):\n    The scope of the access token as described by [Section 3.3](https://tools.ietf.org/html/rfc6749#section-3.3).\n\n","args":[],"type":"{ token : OAuth.Token, refreshToken : Maybe.Maybe OAuth.Token, expiresIn : Maybe.Maybe Basics.Int, scope : List.List String.String }"},{"name":"Authorization","comment":" Request configuration for an authorization (Authorization Code & Implicit flows)\n","args":[],"type":"{ clientId : String.String, url : Url.Url, redirectUri : Url.Url, scope : List.List String.String, state : Maybe.Maybe String.String }"},{"name":"AuthorizationError","comment":" Describes an OAuth error as a result of an authorization request failure\n\n  - error (_REQUIRED_):\n    A single ASCII error code.\n\n  - errorDescription (_OPTIONAL_)\n    Human-readable ASCII text providing additional information, used to assist the client developer in\n    understanding the error that occurred. Values for the `errorDescription` parameter MUST NOT\n    include characters outside the set `%x20-21 / %x23-5B / %x5D-7E`.\n\n  - errorUri (_OPTIONAL_):\n    A URI identifying a human-readable web page with information about the error, used to\n    provide the client developer with additional information about the error. Values for the\n    `errorUri` parameter MUST conform to the URI-reference syntax and thus MUST NOT include\n    characters outside the set `%x21 / %x23-5B / %x5D-7E`.\n\n  - state (_REQUIRED if `state` was present in the authorization request_):\n    The exact value received from the client\n\n","args":[],"type":"{ error : OAuth.ErrorCode, errorDescription : Maybe.Maybe String.String, errorUri : Maybe.Maybe String.String, state : Maybe.Maybe String.String }"},{"name":"AuthorizationSuccess","comment":" The response obtained as a result of an authorization\n\n  - code (_REQUIRED_):\n    The authorization code generated by the authorization server. The authorization code MUST expire\n    shortly after it is issued to mitigate the risk of leaks. A maximum authorization code lifetime of\n    10 minutes is RECOMMENDED. The client MUST NOT use the authorization code more than once. If an\n    authorization code is used more than once, the authorization server MUST deny the request and\n    SHOULD revoke (when possible) all tokens previously issued based on that authorization code. The\n    authorization code is bound to the client identifier and redirection URI.\n\n  - state (_REQUIRED if `state` was present in the authorization request_):\n    The exact value received from the client\n\n","args":[],"type":"{ code : String.String, state : Maybe.Maybe String.String }"},{"name":"Credentials","comment":" Describes at least a `clientId` and if define, a complete set of credentials\nwith the `secret`. The secret is so-to-speak optional and depends on whether the\nauthorization server you interact with requires a 'Basic' authentication on top of\nthe authentication request. Provides it if you need to do so.\n\n      { clientId = \"<my-client-id>\"\n      , secret = Just \"<my-client-secret>\"\n      }\n\n","args":[],"type":"{ clientId : String.String, secret : Maybe.Maybe String.String }"},{"name":"Parsers","comment":" Parsers used in the 'parseCode' function.\n\n  - codeParser: Looks for an 'code' string\n  - errorParser: Looks for an 'error' to build a corresponding `ErrorCode`\n  - authorizationSuccessParser: Selected when the `tokenParser` succeeded to parse the remaining parts\n  - authorizationErrorParser: Selected when the `errorParser` succeeded to parse the remaining parts\n\n","args":[],"type":"{ codeParser : Url.Parser.Query.Parser (Maybe.Maybe String.String), errorParser : Url.Parser.Query.Parser (Maybe.Maybe OAuth.ErrorCode), authorizationSuccessParser : String.String -> Url.Parser.Query.Parser OAuth.AuthorizationCode.AuthorizationSuccess, authorizationErrorParser : OAuth.ErrorCode -> Url.Parser.Query.Parser OAuth.AuthorizationCode.AuthorizationError }"},{"name":"RequestParts","comment":" Parts required to build a request. This record is given to `Http.request` in order\nto create a new request and may be adjusted at will.\n","args":["a"],"type":"{ method : String.String, headers : List.List Http.Header, url : String.String, body : Http.Body, expect : Http.Expect a, timeout : Maybe.Maybe Basics.Float, withCredentials : Basics.Bool }"}],"values":[{"name":"defaultAuthenticationErrorDecoder","comment":" Json decoder for an errored response.\n\n    case res of\n        Err (Http.BadStatus { body }) ->\n            case Json.decodeString OAuth.AuthorizationCode.defaultAuthenticationErrorDecoder body of\n                Ok { error, errorDescription } ->\n                    doSomething\n\n                _ ->\n                    parserFailed\n\n        _ ->\n            someOtherError\n\n","type":"Json.Decode.Decoder OAuth.AuthorizationCode.AuthenticationError"},{"name":"defaultAuthenticationSuccessDecoder","comment":" Json decoder for a positive response. You may provide a custom response decoder using other decoders\nfrom this module, or some of your own craft.\n","type":"Json.Decode.Decoder OAuth.AuthorizationCode.AuthenticationSuccess"},{"name":"defaultAuthorizationErrorParser","comment":" Default response error parser according to RFC-6749\n","type":"OAuth.ErrorCode -> Url.Parser.Query.Parser OAuth.AuthorizationCode.AuthorizationError"},{"name":"defaultAuthorizationSuccessParser","comment":" Default response success parser according to RFC-6749\n","type":"String.String -> Url.Parser.Query.Parser OAuth.AuthorizationCode.AuthorizationSuccess"},{"name":"defaultCodeParser","comment":" Default 'code' parser according to RFC-6749\n","type":"Url.Parser.Query.Parser (Maybe.Maybe String.String)"},{"name":"defaultErrorDecoder","comment":" Json decoder for 'error' field\n","type":"Json.Decode.Decoder OAuth.ErrorCode"},{"name":"defaultErrorDescriptionDecoder","comment":" Json decoder for 'error\\_description' field\n","type":"Json.Decode.Decoder (Maybe.Maybe String.String)"},{"name":"defaultErrorParser","comment":" Default 'error' parser according to RFC-6749\n","type":"Url.Parser.Query.Parser (Maybe.Maybe OAuth.ErrorCode)"},{"name":"defaultErrorUriDecoder","comment":" Json decoder for 'error\\_uri' field\n","type":"Json.Decode.Decoder (Maybe.Maybe String.String)"},{"name":"defaultExpiresInDecoder","comment":" Json decoder for an 'expire' timestamp\n","type":"Json.Decode.Decoder (Maybe.Maybe Basics.Int)"},{"name":"defaultParsers","comment":" Default parsers according to RFC-6749\n","type":"OAuth.AuthorizationCode.Parsers"},{"name":"defaultRefreshTokenDecoder","comment":" Json decoder for a 'refresh\\_token'\n","type":"Json.Decode.Decoder (Maybe.Maybe OAuth.Token)"},{"name":"defaultScopeDecoder","comment":" Json decoder for a 'scope'\n","type":"Json.Decode.Decoder (List.List String.String)"},{"name":"defaultTokenDecoder","comment":" Json decoder for an 'access\\_token'\n","type":"Json.Decode.Decoder OAuth.Token"},{"name":"lenientScopeDecoder","comment":" Json decoder for a 'scope', allowing comma- or space-separated scopes\n","type":"Json.Decode.Decoder (List.List String.String)"},{"name":"makeAuthUrl","comment":" Redirects the resource owner (user) to the resource provider server using the specified\nauthorization flow.\n","type":"OAuth.AuthorizationCode.Authorization -> Url.Url"},{"name":"makeTokenRequest","comment":" Builds a the request components required to get a token from an authorization code\n\n    let req : Http.Request AuthenticationSuccess\n        req = makeTokenRequest authentication |> Http.request\n\n","type":"OAuth.AuthorizationCode.Authentication -> OAuth.AuthorizationCode.RequestParts OAuth.AuthorizationCode.AuthenticationSuccess"},{"name":"parseCode","comment":" Parse the location looking for a parameters set by the resource provider server after\nredirecting the resource owner (user).\n\nReturns `AuthorizationResult Empty` when there's nothing\n\n","type":"Url.Url -> OAuth.AuthorizationCode.AuthorizationResult"},{"name":"parseCodeWith","comment":" See 'parseToken', but gives you the ability to provide your own custom parsers.\n","type":"OAuth.AuthorizationCode.Parsers -> Url.Url -> OAuth.AuthorizationCode.AuthorizationResult"}],"binops":[]},{"name":"OAuth.ClientCredentials","comment":" The client can request an access token using only its client\ncredentials (or other supported means of authentication) when the client is requesting access to\nthe protected resources under its control, or those of another resource owner that have been\npreviously arranged with the authorization server (the method of which is beyond the scope of\nthis specification).\n\nThere's only one step in this process:\n\n  - The client authenticates itself directly using credentials it owns.\n\nAfter this step, the client owns an `access_token` that can be used to authorize any subsequent\nrequest.\n\n\n## Authenticate\n\n@docs Authentication, Credentials, AuthenticationSuccess, AuthenticationError, RequestParts, makeTokenRequest\n\n\n## Json Decoders\n\n@docs defaultAuthenticationSuccessDecoder, defaultAuthenticationErrorDecoder, defaultExpiresInDecoder, defaultScopeDecoder, lenientScopeDecoder, defaultTokenDecoder, defaultRefreshTokenDecoder, defaultErrorDecoder, defaultErrorDescriptionDecoder, defaultErrorUriDecoder\n\n","unions":[],"aliases":[{"name":"Authentication","comment":" Request configuration for a ClientCredentials authentication\n\n    let authentication =\n          -- Credentials needed for Basic authentication\n          { credentials =\n          -- Token endpoint of the resource provider\n          , url = \"<token-endpoint>\"\n          -- Scopes requested, can be empty\n          , scope = [\"read:whatever\"]\n          }\n\n","args":[],"type":"{ credentials : OAuth.ClientCredentials.Credentials, scope : List.List String.String, url : Url.Url }"},{"name":"AuthenticationError","comment":" Describes an OAuth error as a result of a request failure\n\n  - error (_REQUIRED_):\n    A single ASCII error code.\n\n  - errorDescription (_OPTIONAL_)\n    Human-readable ASCII text providing additional information, used to assist the client developer in\n    understanding the error that occurred. Values for the `errorDescription` parameter MUST NOT\n    include characters outside the set `%x20-21 / %x23-5B / %x5D-7E`.\n\n  - errorUri (_OPTIONAL_):\n    A URI identifying a human-readable web page with information about the error, used to\n    provide the client developer with additional information about the error. Values for the\n    `errorUri` parameter MUST conform to the URI-reference syntax and thus MUST NOT include\n    characters outside the set `%x21 / %x23-5B / %x5D-7E`.\n\n","args":[],"type":"{ error : OAuth.ErrorCode, errorDescription : Maybe.Maybe String.String, errorUri : Maybe.Maybe String.String }"},{"name":"AuthenticationSuccess","comment":" The response obtained as a result of an authentication (implicit or not)\n\n  - token (_REQUIRED_):\n    The access token issued by the authorization server.\n\n  - refreshToken (_OPTIONAL_):\n    The refresh token, which can be used to obtain new access tokens using the same authorization\n    grant as described in [Section 6](https://tools.ietf.org/html/rfc6749#section-6).\n\n  - expiresIn (_RECOMMENDED_):\n    The lifetime in seconds of the access token. For example, the value \"3600\" denotes that the\n    access token will expire in one hour from the time the response was generated. If omitted, the\n    authorization server SHOULD provide the expiration time via other means or document the default\n    value.\n\n  - scope (_OPTIONAL, if identical to the scope requested; otherwise, REQUIRED_):\n    The scope of the access token as described by [Section 3.3](https://tools.ietf.org/html/rfc6749#section-3.3).\n\n","args":[],"type":"{ token : OAuth.Token, refreshToken : Maybe.Maybe OAuth.Token, expiresIn : Maybe.Maybe Basics.Int, scope : List.List String.String }"},{"name":"Credentials","comment":" Describes a couple of client credentials used for Basic authentication\n\n      { clientId = \"<my-client-id>\"\n      , secret = \"<my-client-secret>\"\n      }\n\n","args":[],"type":"{ clientId : String.String, secret : String.String }"},{"name":"RequestParts","comment":" Parts required to build a request. This record is given to `Http.request` in order\nto create a new request and may be adjusted at will.\n","args":["a"],"type":"{ method : String.String, headers : List.List Http.Header, url : String.String, body : Http.Body, expect : Http.Expect a, timeout : Maybe.Maybe Basics.Float, withCredentials : Basics.Bool }"}],"values":[{"name":"defaultAuthenticationErrorDecoder","comment":" Json decoder for an errored response.\n\n    case res of\n        Err (Http.BadStatus { body }) ->\n            case Json.decodeString OAuth.ClientCredentials.defaultAuthenticationErrorDecoder body of\n                Ok { error, errorDescription } ->\n                    doSomething\n\n                _ ->\n                    parserFailed\n\n        _ ->\n            someOtherError\n\n","type":"Json.Decode.Decoder OAuth.ClientCredentials.AuthenticationError"},{"name":"defaultAuthenticationSuccessDecoder","comment":" Json decoder for a positive response. You may provide a custom response decoder using other decoders\nfrom this module, or some of your own craft.\n","type":"Json.Decode.Decoder OAuth.ClientCredentials.AuthenticationSuccess"},{"name":"defaultErrorDecoder","comment":" Json decoder for 'error' field\n","type":"Json.Decode.Decoder OAuth.ErrorCode"},{"name":"defaultErrorDescriptionDecoder","comment":" Json decoder for 'error\\_description' field\n","type":"Json.Decode.Decoder (Maybe.Maybe String.String)"},{"name":"defaultErrorUriDecoder","comment":" Json decoder for 'error\\_uri' field\n","type":"Json.Decode.Decoder (Maybe.Maybe String.String)"},{"name":"defaultExpiresInDecoder","comment":" Json decoder for an 'expire' timestamp\n","type":"Json.Decode.Decoder (Maybe.Maybe Basics.Int)"},{"name":"defaultRefreshTokenDecoder","comment":" Json decoder for a 'refresh\\_token'\n","type":"Json.Decode.Decoder (Maybe.Maybe OAuth.Token)"},{"name":"defaultScopeDecoder","comment":" Json decoder for a 'scope'\n","type":"Json.Decode.Decoder (List.List String.String)"},{"name":"defaultTokenDecoder","comment":" Json decoder for an 'access\\_token'\n","type":"Json.Decode.Decoder OAuth.Token"},{"name":"lenientScopeDecoder","comment":" Json decoder for a 'scope', allowing comma- or space-separated scopes\n","type":"Json.Decode.Decoder (List.List String.String)"},{"name":"makeTokenRequest","comment":" Builds a the request components required to get a token from client credentials\n\n    let req : Http.Request TokenResponse\n        req = makeTokenRequest authentication |> Http.request\n\n","type":"OAuth.ClientCredentials.Authentication -> OAuth.ClientCredentials.RequestParts OAuth.ClientCredentials.AuthenticationSuccess"}],"binops":[]},{"name":"OAuth.Implicit","comment":" The implicit grant type is used to obtain access tokens (it does not\nsupport the issuance of refresh tokens) and is optimized for public clients known to operate a\nparticular redirection URI. These clients are typically implemented in a browser using a\nscripting language such as JavaScript.\n\nThis is a 2-step process:\n\n  - The client asks for an authorization and implicit authentication to the OAuth provider: the user is redirected.\n  - The provider redirects the user back and the client parses the request query parameters from the url.\n\nAfter those steps, the client owns an `access_token` that can be used to authorize any subsequent\nrequest.\n\n\n## Authorize\n\n@docs Authorization, AuthorizationResult, AuthorizationSuccess, AuthorizationError, makeAuthUrl, parseToken\n\n\n## Authorize (advanced)\n\n@docs parseTokenWith\n\n\n## Query Parsers\n\n@docs Parsers, defaultParsers, defaultTokenParser, defaultErrorParser, defaultAuthorizationSuccessParser, defaultAuthorizationErrorParser\n\n","unions":[{"name":"AuthorizationResult","comment":" Describes errors coming from attempting to parse a url after an OAuth redirection\n\n  - Empty: means there were nothing (related to OAuth 2.0) to parse\n  - Error: a successfully parsed OAuth 2.0 error\n  - Success: a successfully parsed the response\n\n","args":[],"cases":[["Empty",[]],["Error",["OAuth.Implicit.AuthorizationError"]],["Success",["OAuth.Implicit.AuthorizationSuccess"]]]}],"aliases":[{"name":"Authorization","comment":" Request configuration for an authorization\n","args":[],"type":"{ clientId : String.String, url : Url.Url, redirectUri : Url.Url, scope : List.List String.String, state : Maybe.Maybe String.String }"},{"name":"AuthorizationError","comment":" Describes an OAuth error as a result of an authorization request failure\n\n  - error (_REQUIRED_):\n    A single ASCII error code.\n\n  - errorDescription (_OPTIONAL_)\n    Human-readable ASCII text providing additional information, used to assist the client developer in\n    understanding the error that occurred. Values for the `errorDescription` parameter MUST NOT\n    include characters outside the set `%x20-21 / %x23-5B / %x5D-7E`.\n\n  - errorUri (_OPTIONAL_):\n    A URI identifying a human-readable web page with information about the error, used to\n    provide the client developer with additional information about the error. Values for the\n    `errorUri` parameter MUST conform to the URI-reference syntax and thus MUST NOT include\n    characters outside the set `%x21 / %x23-5B / %x5D-7E`.\n\n  - state (_REQUIRED if `state` was present in the authorization request_):\n    The exact value received from the client\n\n","args":[],"type":"{ error : OAuth.ErrorCode, errorDescription : Maybe.Maybe String.String, errorUri : Maybe.Maybe String.String, state : Maybe.Maybe String.String }"},{"name":"AuthorizationSuccess","comment":" The response obtained as a result of an authentication (implicit or not)\n\n  - token (_REQUIRED_):\n    The access token issued by the authorization server.\n\n  - refreshToken (_OPTIONAL_):\n    The refresh token, which can be used to obtain new access tokens using the same authorization\n    grant as described in [Section 6](https://tools.ietf.org/html/rfc6749#section-6).\n\n  - expiresIn (_RECOMMENDED_):\n    The lifetime in seconds of the access token. For example, the value \"3600\" denotes that the\n    access token will expire in one hour from the time the response was generated. If omitted, the\n    authorization server SHOULD provide the expiration time via other means or document the default\n    value.\n\n  - scope (_OPTIONAL, if identical to the scope requested; otherwise, REQUIRED_):\n    The scope of the access token as described by [Section 3.3](https://tools.ietf.org/html/rfc6749#section-3.3).\n\n  - state (_REQUIRED if `state` was present in the authorization request_):\n    The exact value received from the client\n\n","args":[],"type":"{ token : OAuth.Token, refreshToken : Maybe.Maybe OAuth.Token, expiresIn : Maybe.Maybe Basics.Int, scope : List.List String.String, state : Maybe.Maybe String.String }"},{"name":"Parsers","comment":" Parsers used in the 'parseToken' function.\n\n  - tokenParser: Looks for an 'access\\_token' and 'token\\_type' to build a `Token`\n  - errorParser: Looks for an 'error' to build a corresponding `ErrorCode`\n  - authorizationSuccessParser: Selected when the `tokenParser` succeeded to parse the remaining parts\n  - authorizationErrorParser: Selected when the `errorParser` succeeded to parse the remaining parts\n\n","args":[],"type":"{ tokenParser : Url.Parser.Query.Parser (Maybe.Maybe OAuth.Token), errorParser : Url.Parser.Query.Parser (Maybe.Maybe OAuth.ErrorCode), authorizationSuccessParser : OAuth.Token -> Url.Parser.Query.Parser OAuth.Implicit.AuthorizationSuccess, authorizationErrorParser : OAuth.ErrorCode -> Url.Parser.Query.Parser OAuth.Implicit.AuthorizationError }"}],"values":[{"name":"defaultAuthorizationErrorParser","comment":" Default response error parser according to RFC-6749\n","type":"OAuth.ErrorCode -> Url.Parser.Query.Parser OAuth.Implicit.AuthorizationError"},{"name":"defaultAuthorizationSuccessParser","comment":" Default response success parser according to RFC-6749\n","type":"OAuth.Token -> Url.Parser.Query.Parser OAuth.Implicit.AuthorizationSuccess"},{"name":"defaultErrorParser","comment":" Default 'error' parser according to RFC-6749\n","type":"Url.Parser.Query.Parser (Maybe.Maybe OAuth.ErrorCode)"},{"name":"defaultParsers","comment":" Default parsers according to RFC-6749\n","type":"OAuth.Implicit.Parsers"},{"name":"defaultTokenParser","comment":" Default 'access\\_token' parser according to RFC-6749\n","type":"Url.Parser.Query.Parser (Maybe.Maybe OAuth.Token)"},{"name":"makeAuthUrl","comment":" Redirects the resource owner (user) to the resource provider server using the specified\nauthorization flow.\n","type":"OAuth.Implicit.Authorization -> Url.Url"},{"name":"parseToken","comment":" Parses the location looking for parameters in the 'fragment' set by the\nauthorization server after redirecting the resource owner (user).\n\nReturns `ParseResult Empty` when there's nothing or an invalid Url is passed\n\n","type":"Url.Url -> OAuth.Implicit.AuthorizationResult"},{"name":"parseTokenWith","comment":" See 'parseToken', but gives you the ability to provide your own custom parsers.\n\nThis is especially useful when interacting with authorization servers that don't quite\nimplement the OAuth2.0 specifications.\n\nFor instance, Facebook has several quirks in its implementation:\n\n  - It doesn't return any 'token\\_type'\n\n```\n    tokenParser : Query.Parser (Maybe OAuth.Token)\n    tokenParser =\n        Query.map (OAuth.makeToken (Just \"Bearer\"))\n            (Query.string \"access_token\")\n```\n\n  - It doesn't return any 'error', but returns instead an 'error\\_code'\n\n```\n    errorParser : Query.Parser (Maybe OAuth.ErrorCode)\n    errorParser =\n        Query.map (Maybe.map OAuth.errorCodeFromString)\n          (Query.string \"error_code\")\n```\n\n  - It doesn't return an 'error\\_description', but returns instead an 'error\\_message'\n\n```\n    authorizationErrorParser : OAuth.ErrorCode -> Query.Parser OAuth.Implicit.AuthorizationError\n    authorizationErrorParser errorCode =\n        Query.map3 (OAuth.Implicit.AuthorizationError errorCode)\n            (Query.string \"error_message\")\n            (Query.string \"error_uri\")\n            (Query.string \"state\")\n```\n\n  - It returns the parameters as query parameters instead of a fragment, and even sometimes add a noise fragment\n\n```\n    patchUrl : Url -> Url\n    patchUrl url =\n        if url.fragment == Just \"_=_\" || url.fragment == Nothing then\n                { url | fragment = url.query  }\n\n            _ ->\n                url\n```\n\n","type":"OAuth.Implicit.Parsers -> Url.Url -> OAuth.Implicit.AuthorizationResult"}],"binops":[]},{"name":"OAuth.Password","comment":" The resource owner password credentials grant type is suitable in\ncases where the resource owner has a trust relationship with the\nclient, such as the device operating system or a highly privileged\napplication. The authorization server should take special care when\nenabling this grant type and only allow it when other flows are not\nviable.\n\nThere's only one step in this process:\n\n  - The client authenticates itself directly using the resource owner (user) credentials\n\nAfter this step, the client owns an `access_token` that can be used to authorize any subsequent\nrequest.\n\n\n## Authenticate\n\n@docs Authentication, Credentials, AuthenticationSuccess, AuthenticationError, RequestParts, makeTokenRequest\n\n\n## Json Decoders\n\n@docs defaultAuthenticationSuccessDecoder, defaultAuthenticationErrorDecoder, defaultExpiresInDecoder, defaultScopeDecoder, lenientScopeDecoder, defaultTokenDecoder, defaultRefreshTokenDecoder, defaultErrorDecoder, defaultErrorDescriptionDecoder, defaultErrorUriDecoder\n\n","unions":[],"aliases":[{"name":"Authentication","comment":" Request configuration for a Password authentication\n\n    let authentication =\n          -- Optional, unless required by the resource provider\n          { credentials = credentials\n          -- Resource owner's password\n          , password = \"<user-password>\"\n          -- Scopes requested, can be empty\n          , scope = [\"read:whatever\"]\n          -- Token endpoint of the resource provider\n          , url = \"<token-endpoint>\"\n          -- Resource owner's username\n          , username = \"<user-username>\"\n          }\n\n","args":[],"type":"{ credentials : Maybe.Maybe OAuth.Password.Credentials, password : String.String, scope : List.List String.String, url : Url.Url, username : String.String }"},{"name":"AuthenticationError","comment":" Describes an OAuth error as a result of a request failure\n\n  - error (_REQUIRED_):\n    A single ASCII error code.\n\n  - errorDescription (_OPTIONAL_)\n    Human-readable ASCII text providing additional information, used to assist the client developer in\n    understanding the error that occurred. Values for the `errorDescription` parameter MUST NOT\n    include characters outside the set `%x20-21 / %x23-5B / %x5D-7E`.\n\n  - errorUri (_OPTIONAL_):\n    A URI identifying a human-readable web page with information about the error, used to\n    provide the client developer with additional information about the error. Values for the\n    `errorUri` parameter MUST conform to the URI-reference syntax and thus MUST NOT include\n    characters outside the set `%x21 / %x23-5B / %x5D-7E`.\n\n","args":[],"type":"{ error : OAuth.ErrorCode, errorDescription : Maybe.Maybe String.String, errorUri : Maybe.Maybe String.String }"},{"name":"AuthenticationSuccess","comment":" The response obtained as a result of an authentication (implicit or not)\n\n  - token (_REQUIRED_):\n    The access token issued by the authorization server.\n\n  - refreshToken (_OPTIONAL_):\n    The refresh token, which can be used to obtain new access tokens using the same authorization\n    grant as described in [Section 6](https://tools.ietf.org/html/rfc6749#section-6).\n\n  - expiresIn (_RECOMMENDED_):\n    The lifetime in seconds of the access token. For example, the value \"3600\" denotes that the\n    access token will expire in one hour from the time the response was generated. If omitted, the\n    authorization server SHOULD provide the expiration time via other means or document the default\n    value.\n\n  - scope (_OPTIONAL, if identical to the scope requested; otherwise, REQUIRED_):\n    The scope of the access token as described by [Section 3.3](https://tools.ietf.org/html/rfc6749#section-3.3).\n\n","args":[],"type":"{ token : OAuth.Token, refreshToken : Maybe.Maybe OAuth.Token, expiresIn : Maybe.Maybe Basics.Int, scope : List.List String.String }"},{"name":"Credentials","comment":" Describes at least a `clientId` and if define, a complete set of credentials\nwith the `secret`. Optional but may be required by the authorization server you\ninteract with to perform a 'Basic' authentication on top of the authentication request.\n\n      { clientId = \"<my-client-id>\"\n      , secret = \"<my-client-secret>\"\n      }\n\n","args":[],"type":"{ clientId : String.String, secret : String.String }"},{"name":"RequestParts","comment":" Parts required to build a request. This record is given to `Http.request` in order\nto create a new request and may be adjusted at will.\n","args":["a"],"type":"{ method : String.String, headers : List.List Http.Header, url : String.String, body : Http.Body, expect : Http.Expect a, timeout : Maybe.Maybe Basics.Float, withCredentials : Basics.Bool }"}],"values":[{"name":"defaultAuthenticationErrorDecoder","comment":" Json decoder for an errored response.\n\n    case res of\n        Err (Http.BadStatus { body }) ->\n            case Json.decodeString OAuth.Password.defaultAuthenticationErrorDecoder body of\n                Ok { error, errorDescription } ->\n                    doSomething\n\n                _ ->\n                    parserFailed\n\n        _ ->\n            someOtherError\n\n","type":"Json.Decode.Decoder OAuth.Password.AuthenticationError"},{"name":"defaultAuthenticationSuccessDecoder","comment":" Json decoder for a positive response. You may provide a custom response decoder using other decoders\nfrom this module, or some of your own craft.\n","type":"Json.Decode.Decoder OAuth.Password.AuthenticationSuccess"},{"name":"defaultErrorDecoder","comment":" Json decoder for 'error' field\n","type":"Json.Decode.Decoder OAuth.ErrorCode"},{"name":"defaultErrorDescriptionDecoder","comment":" Json decoder for 'error\\_description' field\n","type":"Json.Decode.Decoder (Maybe.Maybe String.String)"},{"name":"defaultErrorUriDecoder","comment":" Json decoder for 'error\\_uri' field\n","type":"Json.Decode.Decoder (Maybe.Maybe String.String)"},{"name":"defaultExpiresInDecoder","comment":" Json decoder for an 'expire' timestamp\n","type":"Json.Decode.Decoder (Maybe.Maybe Basics.Int)"},{"name":"defaultRefreshTokenDecoder","comment":" Json decoder for a 'refresh\\_token'\n","type":"Json.Decode.Decoder (Maybe.Maybe OAuth.Token)"},{"name":"defaultScopeDecoder","comment":" Json decoder for a 'scope'\n","type":"Json.Decode.Decoder (List.List String.String)"},{"name":"defaultTokenDecoder","comment":" Json decoder for an 'access\\_token'\n","type":"Json.Decode.Decoder OAuth.Token"},{"name":"lenientScopeDecoder","comment":" Json decoder for a 'scope', allowing comma- or space-separated scopes\n","type":"Json.Decode.Decoder (List.List String.String)"},{"name":"makeTokenRequest","comment":" Builds a the request components required to get a token from the resource owner (user) credentials\n\n    let req : Http.Request TokenResponse\n        req = makeTokenRequest authentication |> Http.request\n\n","type":"OAuth.Password.Authentication -> OAuth.Password.RequestParts OAuth.Password.AuthenticationSuccess"}],"binops":[]},{"name":"OAuth.Refresh","comment":" If the authorization server issued a refresh token to the client, the\nclient may make a refresh request to the token endpoint to obtain a new access token\n(and refresh token) from the authorization server.\n\nThere's only one step in this process:\n\n    - The client authenticates itself directly using the previously obtained refresh token\n\nAfter this step, the client owns a fresh `access_token` and possibly, a new `refresh_token`. Both\ncan be used in subsequent requests.\n\n\n## Authenticate\n\n@docs Authentication, Credentials, AuthenticationSuccess, AuthenticationError, RequestParts, makeTokenRequest\n\n\n## Json Decoders\n\n@docs defaultAuthenticationSuccessDecoder, defaultAuthenticationErrorDecoder, defaultExpiresInDecoder, defaultScopeDecoder, lenientScopeDecoder, defaultTokenDecoder, defaultRefreshTokenDecoder, defaultErrorDecoder, defaultErrorDescriptionDecoder, defaultErrorUriDecoder\n\n","unions":[],"aliases":[{"name":"Authentication","comment":" Request configuration for a Refresh authentication\n\n    let authentication =\n          -- Optional, unless required by the resource provider\n          { credentials = Nothing\n          -- Scopes requested, can be empty\n          , scope = [\"read:whatever\"]\n          -- A refresh token previously delivered\n          , token = OAuth.Bearer \"abcdef1234567890\"\n          -- Token endpoint of the resource provider\n          , url = \"<token-endpoint>\"\n          }\n\n","args":[],"type":"{ credentials : Maybe.Maybe OAuth.Refresh.Credentials, token : OAuth.Token, scope : List.List String.String, url : Url.Url }"},{"name":"AuthenticationError","comment":" Describes an OAuth error as a result of a request failure\n\n  - error (_REQUIRED_):\n    A single ASCII error code.\n\n  - errorDescription (_OPTIONAL_)\n    Human-readable ASCII text providing additional information, used to assist the client developer in\n    understanding the error that occurred. Values for the `errorDescription` parameter MUST NOT\n    include characters outside the set `%x20-21 / %x23-5B / %x5D-7E`.\n\n  - errorUri (_OPTIONAL_):\n    A URI identifying a human-readable web page with information about the error, used to\n    provide the client developer with additional information about the error. Values for the\n    `errorUri` parameter MUST conform to the URI-reference syntax and thus MUST NOT include\n    characters outside the set `%x21 / %x23-5B / %x5D-7E`.\n\n","args":[],"type":"{ error : OAuth.ErrorCode, errorDescription : Maybe.Maybe String.String, errorUri : Maybe.Maybe String.String }"},{"name":"AuthenticationSuccess","comment":" The response obtained as a result of an authentication (implicit or not)\n\n  - token (_REQUIRED_):\n    The access token issued by the authorization server.\n\n  - refreshToken (_OPTIONAL_):\n    The refresh token, which can be used to obtain new access tokens using the same authorization\n    grant as described in [Section 6](https://tools.ietf.org/html/rfc6749#section-6).\n\n  - expiresIn (_RECOMMENDED_):\n    The lifetime in seconds of the access token. For example, the value \"3600\" denotes that the\n    access token will expire in one hour from the time the response was generated. If omitted, the\n    authorization server SHOULD provide the expiration time via other means or document the default\n    value.\n\n  - scope (_OPTIONAL, if identical to the scope requested; otherwise, REQUIRED_):\n    The scope of the access token as described by [Section 3.3](https://tools.ietf.org/html/rfc6749#section-3.3).\n\n","args":[],"type":"{ token : OAuth.Token, refreshToken : Maybe.Maybe OAuth.Token, expiresIn : Maybe.Maybe Basics.Int, scope : List.List String.String }"},{"name":"Credentials","comment":" Describes a couple of client credentials used for Basic authentication\n\n      { clientId = \"<my-client-id>\"\n      , secret = \"<my-client-secret>\"\n      }\n\n","args":[],"type":"{ clientId : String.String, secret : String.String }"},{"name":"RequestParts","comment":" Parts required to build a request. This record is given to `Http.request` in order\nto create a new request and may be adjusted at will.\n","args":["a"],"type":"{ method : String.String, headers : List.List Http.Header, url : String.String, body : Http.Body, expect : Http.Expect a, timeout : Maybe.Maybe Basics.Float, withCredentials : Basics.Bool }"}],"values":[{"name":"defaultAuthenticationErrorDecoder","comment":" Json decoder for an errored response.\n\n    case res of\n        Err (Http.BadStatus { body }) ->\n            case Json.decodeString OAuth.ClientCredentials.defaultAuthenticationErrorDecoder body of\n                Ok { error, errorDescription } ->\n                    doSomething\n\n                _ ->\n                    parserFailed\n\n        _ ->\n            someOtherError\n\n","type":"Json.Decode.Decoder OAuth.Refresh.AuthenticationError"},{"name":"defaultAuthenticationSuccessDecoder","comment":" Json decoder for a positive response. You may provide a custom response decoder using other decoders\nfrom this module, or some of your own craft.\n","type":"Json.Decode.Decoder OAuth.Refresh.AuthenticationSuccess"},{"name":"defaultErrorDecoder","comment":" Json decoder for 'error' field\n","type":"Json.Decode.Decoder OAuth.ErrorCode"},{"name":"defaultErrorDescriptionDecoder","comment":" Json decoder for 'error\\_description' field\n","type":"Json.Decode.Decoder (Maybe.Maybe String.String)"},{"name":"defaultErrorUriDecoder","comment":" Json decoder for 'error\\_uri' field\n","type":"Json.Decode.Decoder (Maybe.Maybe String.String)"},{"name":"defaultExpiresInDecoder","comment":" Json decoder for an 'expire' timestamp\n","type":"Json.Decode.Decoder (Maybe.Maybe Basics.Int)"},{"name":"defaultRefreshTokenDecoder","comment":" Json decoder for a 'refresh\\_token'\n","type":"Json.Decode.Decoder (Maybe.Maybe OAuth.Token)"},{"name":"defaultScopeDecoder","comment":" Json decoder for a 'scope'\n","type":"Json.Decode.Decoder (List.List String.String)"},{"name":"defaultTokenDecoder","comment":" Json decoder for an 'access\\_token'\n","type":"Json.Decode.Decoder OAuth.Token"},{"name":"lenientScopeDecoder","comment":" Json decoder for a 'scope', allowing comma- or space-separated scopes\n","type":"Json.Decode.Decoder (List.List String.String)"},{"name":"makeTokenRequest","comment":" Builds a the request components required to refresh a token\n\n    let req : Http.Request TokenResponse\n        req = makeTokenRequest reqParts |> Http.request\n\n","type":"OAuth.Refresh.Authentication -> OAuth.Refresh.RequestParts OAuth.Refresh.AuthenticationSuccess"}],"binops":[]}]