Upload function internally uses the ImageKit.io javascript SDK *ĪuthenticationEndpoint is implemented in backedn i.e. The SDK internally makes an HTTP GET request to this endpoint and expects a JSON response with three fields, i.e. We will implement authenticationEndpoint on the backend. Here we will initialize the Javascript SDK and will be needing urlEndpoint, publicKey and authenticationEndpoint parameters.Ĭopy urlEndpoint and publicKey the developer section in your ImageKit dashboard. Let's include the ImageKit Javascript SDK. Since we need to generate a signature, we will use the ImageKit Node.js SDK on the server-side. It provides an easy to use wrapper around upload API. We will be using the ImageKit Javascript SDK on the client-side. Using SDKs to simplify upload & signature generation ? So overall, your frontend application triggers the actual upload while your backend is responsible for generating the signature. The client-side application can push this response on the backend. The upload API responds with a successful response.The client-side application will call ImageKit upload API with actual file content, signature, and other file upload options.The signature should never be generated on the client-side. The backend will generate this signature using your account's private key. The client-side application will fetch a signature from your backend.Your users will upload the file on the client-side (browser).However, when uploading files directly from the client-side, the authentication has to be done by providing a signature, which can only be generated using your account's private key.īefore we write code, let's understand all the steps: Authenticating using a secret private key is straightforward when uploading files from a secure location such as your backend application. To use it, you will need some authentication. This forever free plan has generous storage limits, which is good enough for many small and medium scale web applications. In case you haven't already registered, create a free account on ImageKit.
0 Comments
Leave a Reply.AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |