Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preview.js CDN includes box API version 2.0 appends to API_HOST #1480

Open
sgatkal opened this issue Jun 5, 2023 · 0 comments
Open

Preview.js CDN includes box API version 2.0 appends to API_HOST #1480

sgatkal opened this issue Jun 5, 2023 · 0 comments

Comments

@sgatkal
Copy link

sgatkal commented Jun 5, 2023

Environment: JS

Preview version: 2.93.0 (latest)
Steps to reproduce the problem:

  1. After adding API_HOST in use a reverse proxy and instead of using api.box.com use a custom domain.
    Below is example of code.
    var oB=document.getElementById('preview');
    var addExtraHeaders = (config /* https://github.com/axios/axios#request-config */) => {
    config.headers['ApplicationId'] = '12345';
    return config;
    };
    oB.onload=function(){
    var accessToken = 'ygasdfygasldlkfnjasdf';
    var fileId = 5454151;
    var preview = new Box.Preview();
    preview.show(
    fileId,
    accessToken,
    {
    apiHost: "https://mydocuments.getme.com/",
    requestInterceptor: addExtraHeaders,
    container: "#my-doc", showDownload:true,
    logoUrl:'.\images\myorg.png'
    }
    );

  2. Once call made from Preview.js CDN it appends /2.0/ to original API_HOST.

  3. Additional 2.0 makes it difficult to customize API call while using Preview.js CDN library.

What is the expected behavior? (Screenshots can be helpful here)
the expected behavior is when we pass Custom API host it should not append any version to request API. This call should be agnostic to BOX API version and should call files [https://api.box.com/2.0/files/12345].
May be version [2.0] should be an options to provide along with API_HOST url.

What went wrong? (Screenshots, console logs, or HAR files can be helpful here)
Customization with API_HOST URL not working due to version got appended to request. This creates dependencies on BOX API version and custom API.
Is it possible that instead of appending 2.0 to API host create options to pass version along with API_HOST or use https://api.box.com/2.0/ as a default BOX_API URL in CDN.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant