Hi all,
i noticed that on a self hosted grist installation the plugin api for getAccessToken (grist-plugin-api - Grist Help Center )
const tokenInfo = await grist.docApi.getAccessToken({readOnly: true});
console.log(tokenInfo.baseUrl)
returns a url like this:
http://0.0.0.0:8484/o/docs/api/docs/irtKNL9u3sBr/attachments/3/download?auth=eyJhbG..o400w
So the host is: 0.0.0.0 this does not work.
Is this a setting in my grist installation? Or is this a bug?
Ouch, thanks for flagging that @enthus1ast . I think that ultimately the domain in that URL may come from:
return `http://${this.host}:${port}`;
}
/**
* Get a url for the home server api. Called without knowledge of a specific
* request, so will default to a generic url. Use of this method can render
* code incompatible with custom base domains (currently, sendgrid notifications
* via Notifier are incompatible for this reason).
*/
public getDefaultHomeUrl(): string {
const homeUrl = process.env.APP_HOME_URL || (this._has('api') && this.getOwnUrl());
if (!homeUrl) { throw new Error("need APP_HOME_URL"); }
return homeUrl;
}
/**
* Get a url for the home server api, adapting it to match the base domain in the
* requested url. This adaptation is important for cookie-based authentication.
*
* If relPath is given, returns that path relative to homeUrl. If omitted, note that
* getHomeUrl() will still return a URL ending in "/".
Do you have an APP_HOME_URL
environment variable set? If not, can you try setting APP_HOME_URL
to e.g. http(s)://however.your.grist.install.is.reached
, and see if that helps?
1 Like
Yes that fixed it! Thank you!
I’ve added this to my local docker command line:
-e APP_HOME_URL="http://127.0.0.1:8484"
1 Like