spotless/oauth_2_1/token

Types

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 GrantType {
  AuthorizationCode
  RefreshToken
}

Constructors

  • AuthorizationCode
  • RefreshToken
pub type Request {
  Request(
    grant_type: GrantType,
    client_id: String,
    code: String,
    code_verifier: String,
    redirect_uri: String,
  )
}

Constructors

  • Request(
      grant_type: GrantType,
      client_id: String,
      code: String,
      code_verifier: String,
      redirect_uri: String,
    )
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 error_code_from_string(
  string: String,
) -> Result(Fail, String)
pub fn error_code_to_string(code: Fail) -> String
pub fn params_to_http(
  endpoint: #(origin.Origin, String),
  query: List(#(String, String)),
) -> request.Request(BitArray)
pub fn request_from_http(
  request: request.Request(BitArray),
  redirect_uri: String,
) -> Result(Request, #(Fail, String))
pub fn request_from_params(
  params: List(#(String, String)),
  redirect_uri: String,
) -> Result(Request, #(Fail, String))
pub fn request_to_http(
  endpoint: #(origin.Origin, String),
  request: Request,
) -> request.Request(BitArray)
pub fn response_from_http(
  response: response.Response(BitArray),
) -> Result(Result(Response, ErrorResponse), json.DecodeError)
pub fn response_to_body(response: Response) -> String
Search Document