Skip to content

Allow writing to user-secrets from code #43139

Closed
@hansmbakker

Description

@hansmbakker

Is there an existing issue for this?

  • I have searched the existing issues

Is your feature request related to a problem? Please describe the problem.

I am building a client to an external API which is protected by OAuth2 (using access_tokens and refresh_tokens).
In order to prevent logging in every time, I need to store the obtained access_token and refresh_token somewhere in between runs.

dotnet user-secrets works well for reading development secrets, but it is not well suited to invoke from C# (for the usecase of saving a token upon login, or for the usecase of saving new tokens after using the refresh_token: there is no Nuget package for it, so you would need to make a Process.Run call.

Describe the solution you'd like

I would like the core of dotnet user-secrets to be packaged as nuget package, so that I could update secrets from my code easily without having to write a wrapper around the CLI tool.

Alternative which I would not like is writing a wrapper around Process.Run.
Another alternative is doing a File.WriteAllText() / File.ReadAllText() on serialized OAuth2-tokens myself.

I also found the work in progress on dotnet user-jwts / #41956, but I believe that tool has a different purpose.

Additional context

I am building an Uno Platform project so I am looking for something that is cross platform.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-networkingIncludes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions