Skip to main content

parse_validation_response

Function parse_validation_response 

Source
pub fn parse_validation_response(json: String) -> Result<NodeClientInfo>
Expand description

Create a validated client info from a server validation response JSON string.

This parses the response from POST /api/v1/auth/validate.

ยงExample

const { parseValidationResponse } = require('briefcase-node');

const resp = await fetch('http://localhost:8080/api/v1/auth/validate', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({ api_key: 'sk-my-key' })
});
const data = await resp.json();
const clientInfo = parseValidationResponse(JSON.stringify(data));
console.log(clientInfo.client_id);