class WarpEngine::Api::Auth::DeviceTokensController
The polling half of the device authorization grant: a client trades its device code for a token once the person has approved the sign-in.
Public Instance Methods
Source
# File app/controllers/warp_engine/api/auth/device_tokens_controller.rb, line 23 def create state, plain = service.poll(device_code: params[:device_code]) body = { state: state.to_s } body[:token] = plain if plain.present? render json: body rescue WarpEngine::DeviceGrantService::UnknownCode render json: { error: "Not found" }, status: :not_found end
POST /api/auth/device/token.
- device_code
-
the device code from
POST /api/auth/device
Renders { "state": ... }, the grantβs state (pending, approved, denied or expired), plus token, the plain bearer token, in the one response that hands it over. Responds 404 for an unknown device code.