class

Comrade::Providers::BaseProvider

Inherits Reference < Object

Abstract base class for all OAuth providers

Constructors

new(client_id : String, redirect_uri : String, client_secret : String | Nil = nil)
Source

Instance methods

client_id
Source
client_secret
Source
generate_code_challenge(code_verifier : String) : String

Generate code challenge from code verifier for PKCE

Source
generate_code_verifier

Generate a code verifier for PKCE

Source
generate_state

Generate a random state parameter for CSRF protection

Source
get_token(code : String, state : String | Nil = nil, **options) : Token

Exchange authorization code for access token

Source
get_user(token : Token) : User

Get user information using access token

Source
http_client
Source
redirect(scopes : Array(String) = [] of String, state : String | Nil = nil, **options) : String

Generate authorization URL to redirect user to OAuth provider

Source
redirect_uri
Source
refresh_token(refresh_token : String, **options) : Token

Refresh access token

Source
revoke_token(token : String) : Bool

Revoke access token (if supported by provider)

Source