mirror of
https://github.com/danbee/micropub.git
synced 2025-03-04 08:59:13 +00:00
27 lines
410 B
Ruby
27 lines
410 B
Ruby
module Indieauth
|
|
class Token
|
|
def initialize(endpoint)
|
|
@endpoint = endpoint
|
|
end
|
|
|
|
def validate(token)
|
|
response = Faraday.get(
|
|
endpoint,
|
|
nil,
|
|
"Accept" => "application/json",
|
|
"Authorization" => "Bearer #{token}"
|
|
)
|
|
|
|
if response.status == 200
|
|
return true
|
|
end
|
|
|
|
false
|
|
end
|
|
|
|
private
|
|
|
|
attr_accessor :endpoint
|
|
end
|
|
end
|