⁉️Troubleshooting Credentials
If you are having issues with the credential store, please verify a couple of things. More than likely, it's one of the following issues:
Pathing
Verify that you are not setting the current working directory
to something outside of the executable while the Perigee is initializing.
A typical load cycle for a Perigee Application looks like this:
//Initialize Perigee, and configure credentials
PerigeeApplication.ApplicationNoInit("App", (c) => {
CredentialStore.RegisterConnectionString("main", "main_test");
CredentialStore.RegisterRefresh("customCred", (o) => {});
});
This verifies that the current working directory and pathing is correct. This will load the credential file under $WorkingDirectory/credentialStore/credentials.[pcb|pce]
depending on the encryption settings.
Initialize outside Perigee
See the documentation in PerigeeApplication.
Naming the Credential
Unless you've got a VERY specific reason to do so, please don't name the credential. The reason is that you want the RefreshName
to match the CredentialName
.
In the below BAD example, we're naming it "DiffName"
, this will cause the credential to be persisted as this name, not "customCred"
. - the refresh name. If the application was to request a new credential it would forcibly refresh every time as the stored credential name is different.
// BAD EXAMPLE
CredentialStore.RegisterRefresh("customCred", (o) => {
return new CredentialStoreItem() { Name = "DiffName", Expiration = DateTimeOffset.UtcNow.AddHours(1) };
});
//Forcibly calls refresh method every time, since the persisted name is different
var c = CredentialStore.GetCredential("customCred");
Last updated