spotless/oauth_2_1/token

Types

pub type AuthorizationCode {
  AuthorizationCode(
    client_id: String,
    code: String,
    code_verifier: String,
  )
}

Constructors

  • AuthorizationCode(
      client_id: String,
      code: String,
      code_verifier: String,
    )
pub type ErrorResponse {
  ErrorResponse(
    error: String,
    error_description: option.Option(String),
    error_uri: option.Option(String),
  )
}

Constructors

pub type Fail {
  InvalidRequest
  InvalidClient
  InvalidGrant
  UnauthorizedClient
  UnsupportedGrantType
  InvalidScope
}

Constructors

  • InvalidRequest
  • InvalidClient
  • InvalidGrant
  • UnauthorizedClient
  • UnsupportedGrantType
  • InvalidScope
pub type Response {
  Response(
    access_token: String,
    token_type: String,
    expires_in: option.Option(Int),
    scope: List(String),
    refresh_token: option.Option(String),
  )
}

Constructors

  • Response(
      access_token: String,
      token_type: String,
      expires_in: option.Option(Int),
      scope: List(String),
      refresh_token: option.Option(String),
    )

Values

pub fn authorization_code_from_params(
  params: List(#(String, String)),
) -> Result(AuthorizationCode, #(Fail, String))
pub fn authorization_code_to_http(
  endpoint: #(origin.Origin, String),
  request: AuthorizationCode,
) -> request.Request(BitArray)
pub fn error_code_from_string(
  string: String,
) -> Result(Fail, String)
pub fn error_code_to_string(code: Fail) -> String
pub fn error_response_from_http(
  response: response.Response(BitArray),
) -> Result(ErrorResponse, json.DecodeError)
pub fn error_response_to_http(
  response: ErrorResponse,
) -> response.Response(BitArray)
pub fn params_to_http(
  endpoint: #(origin.Origin, String),
  params: List(#(String, String)),
) -> request.Request(BitArray)

Deprecated: use httpx.post_form_params instead

Unconstrained set of parameters to a token request, must include grant_type to be valid.

pub fn request_from_http(
  request: request.Request(BitArray),
) -> Result(#(String, List(#(String, String))), #(Fail, String))
pub fn response_from_http(
  response: response.Response(BitArray),
) -> Result(Result(Response, ErrorResponse), json.DecodeError)
pub fn response_to_body(response: Response) -> String
pub fn token_error_response_decoder() -> decode.Decoder(
  ErrorResponse,
)
Search Document