zendesk / zcli

A command-line tool for Zendesk
https://developer.zendesk.com
Apache License 2.0
62 stars 20 forks source link

Debugging an App locally with zcli proxy error #191

Open slavoroi opened 1 year ago

slavoroi commented 1 year ago

Expectations

Debugging locally with ?zcli_apps=true should be possible with proxy server.

Reality

When debugging locally and trying to call google authenitcation api call for example I get proxy errors and a code of 422. It works in production, but doesn't work locally with "?zcli_apps=true"

  Proxy error: {:code=>"UnprocessableEntity", :status=>"422", :title=>"Unprocessable Entity", :message=>"Failed to get installation and oauth information for app."}

Steps to Reproduce

  1. Run Zendesk app locally with local zcli.apps.config.json that has setting.apiKey & setting.email & setting.password and calling proxy server.

Issue details

running this code fails with proxy server:

const AUTH_URL =
  'https://identitytoolkit.googleapis.com/v1/accounts:signInWithPassword?key={{setting.apiKey}}';

async function authenticate() {
  const settings = {
    url: AUTH_URL,
    type: 'POST',
    contentType: 'application/json',
    data: JSON.stringify({
      email: '{{setting.email}}',
      password: '{{setting.password}}',
      returnSecureToken: true,
    }),
    secure: true,
    dataType: 'json',
  };

  const response = await _client.request(settings);
  return response.idToken;
}

Also, I tried adding "https://joindaisy.zendesk.com/" as an allowed domain in firebase.

oI_wMFB8Rb_RcCYO2V1jZw (1)