solcates / elm-openid-connect / OpenIDConnect

An OpenID Connect implementation

Token


type Token data

Token holder

tokenRaw : Token data -> String

Returns the raw encoded token as a string

tokenData : Token data -> data

Returns the data of a Token

parseToken : Json.Decode.Decoder data -> String -> Result ParseErr (Token data)

Parse a token

showToken : Token data -> String

Returns the token as a string

Responses


type ParseErr
    = NoToken
    | Error String
    | OAuthErr ErrorMessage

Error returned by parsing functions

parse : Json.Decode.Decoder data -> Url -> Result ParseErr (Token data)

Extracts a Token from a location

parseWithNonce : String -> Json.Decode.Decoder data -> Url -> Result ParseErr (Token data)

Extracts a Token from a location and check the incoming nonce

Requests

authorize : Authorization -> Platform.Cmd.Cmd msg

Build a Cmd that will redirect to the identity provider

Make sure to use withNonce

newAuth : Url -> Url -> String -> List String -> Authorization

Creates a Authorization

withScope : List String -> Authorization -> Authorization

Add a custom scope to a Authorization

withState : String -> Authorization -> Authorization

Add a custom state to a Authorization

withNonce : String -> Authorization -> Authorization

Add a nonce to a Authorization (required)

If omitted, the authorize function will work but the openid-connect protocol will not be respected. See http://openid.net/specs/openid-connect-core-1_0.html#ImplicitAuthRequest

withParam : String -> String -> Authorization -> Authorization

Add additional querystring parameters to the authorize url

Use

use : Token data -> List Http.Header -> List Http.Header

Use a token to authenticate a request.