MCPcopy
hub / github.com/ory/hydra / HandleDeviceUserAuthRequest

Method HandleDeviceUserAuthRequest

flow/flow.go:277–292  ·  view source on GitHub ↗

HandleDeviceUserAuthRequest updates the flows fields from a handled request.

(h *HandledDeviceUserAuthRequest)

Source from the content-addressed store, hash-verified

275
276// HandleDeviceUserAuthRequest updates the flows fields from a handled request.
277func (f *Flow) HandleDeviceUserAuthRequest(h *HandledDeviceUserAuthRequest) error {
278 if err := f.State.IsAny(DeviceFlowStateInitialized, DeviceFlowStateUnused); err != nil {
279 return err
280 }
281
282 f.State = DeviceFlowStateUnused
283
284 f.Client = h.Client
285 f.ClientID = h.Client.GetID()
286 f.DeviceCodeRequestID = sqlxx.NullString(h.DeviceCodeRequestID)
287 f.DeviceHandledAt = sqlxx.NullTime(time.Now().UTC())
288 f.RequestedScope = h.RequestedScope
289 f.RequestedAudience = h.RequestedAudience
290
291 return nil
292}
293
294// InvalidateDeviceRequest shifts the flow state to DeviceFlowStateUsed. This
295// transition is executed upon device completion.

Callers 2

acceptUserCodeRequestMethod · 0.80

Calls 3

IsAnyMethod · 0.80
GetIDMethod · 0.65
NowMethod · 0.65

Tested by 1