Skip to content

renameFile attempt gets 'Invalid CSRF Token' #73

@CamTheGoblin

Description

@CamTheGoblin

I am attempting to rename a file , pretty much following along with the example in the documentation. but it is getting an Error response: { error: 'Invalid CSRF Token' }

here is how I have the code set up:

await imagekit.renameFile({
	filePath: oldFilePath,
	newFileName: "newImageName.jpg",
	purgeCache: false,
})

Just before this I am retrieving the oldFilePath value via a imagekit.getFileDetails call:

const { filePath:oldFilePath } = await imagekit.getFileDetails(fileID)

and that is correctly giving me the file path, so the ImageKit instance appears to be set up correctly, its just the renameFile that is failing on me.
I am running the in a NextJS application as a localhost server in case that makes a difference. I am not familiar with CSRF Tokens, is there something I have to change to get the tokens to validate correctly?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions