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

Revalidate API token #334

Closed
tayteboss opened this issue Nov 9, 2023 · 6 comments
Closed

Revalidate API token #334

tayteboss opened this issue Nov 9, 2023 · 6 comments

Comments

@tayteboss
Copy link

I have to revalidate my API token after I have entered it on the initial start up. I have been trying to show the document in the Sanity Studio as it's described here in the readme

The token is stored in the dataset as a document of the type mux.apiKey with the id secrets.mux. Having the ID be non-root ensures that only editors are able to see it.

I have also tried deleting the studio and setting it up fresh however the keys seem to be stored in cached somewhere and I cannot get that start up screen again. Any information here would be great.

Screenshot 2023-11-09 at 11 19 02 am
@Lehmons
Copy link

Lehmons commented Nov 10, 2023

Hey, I have the same issue, was there a solution for this. Seems to be cached somewhere, uninstalling the plugin and reinstalling doesn't fix

@Lehmons
Copy link

Lehmons commented Nov 10, 2023

It seems to be cached in the dataset somehow, creating a new one resolved the issue

@HumidBrains
Copy link

HumidBrains commented Nov 15, 2023

This plugin seems half baked. There is no info in the UI explaining the signed url opinion and if checked, you cannot revoke your choice. Then you'll have to try to remove all related code everywhere to try to reset, but then you'll get invalid credentials error. Creating a new dataset is not an option for me so for now, no MUX it is.

@Lehmons
Copy link

Lehmons commented Nov 15, 2023

I agree and I am sorry to read this, I do get your frustrations. I was rather lucky for this to happen to me on a small site.

I did the usual, deleted npm, and removed package-lock.j.son.
I then removed this plugin from sanity.config....then reinstalled it all.

To my dismay it is cached in the data set. So I created a new one.

Solution:

  • Create a new data set but keep project.
  • Renaimed it "production-2".
  • Replaced "production" with"production-2" in sanity.config, next.config and sanity.cli.js

It allowed me to reset.

Draw back is you need to then populate the new data set.

@HumidBrains
Copy link

As I found out here, the trick is to run this CLI command: sanity documents delete secrets.mux
It deletes the stored mux data in the dataset and you'll be able to reconfigure the API.

@hdoro
Copy link
Collaborator

hdoro commented May 20, 2024

Thank you both @Lehmons and @HumidBrains for the feedback and sorry for the wait and frustrating experience.

We're still considering ways of making this flow more robust, but we've made the following improvements:

  • Note on the signing key behavior in the documentation (at the time of writing, it'll come in an upcoming release)
  • Ability to configure the plugin's credentials at any time from the uploader/input
    • This allows you to swap the signing key and have the plugin re-generate the private key, which would fix the reported issues

And to clarify, the cached key is private. The _id: 'secrets.mux' document is private via Sanity's ID paths, so you're safe :)


I'm closing this issue, feel free to comment and tag me if there's something else I'm missing - thank you again 🙏

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

4 participants