Export and Import Affinidi Login Setup
Affinidi CLI and Affinidi Portal allows you to export your Login Configurations and User Groups created under a particular project. Using the exported JSON file, you can import them to your selected project. To do this, follow the steps below:
Before you begin
- Set up Affinidi Vault account. Follow the guide below if you haven’t set it up yet.
- Install the Affinidi CLI. Follow the guide below if it hasn’t been installed.
Export and Import Using Affinidi Portal
Export Login Configurations and User Groups
Go to Affinidi Portal and log in to the Affinidi Portal using your Affinidi Vault.
Go to Affinidi Login service and click on dropdown button called Actions. Make sure that you have selected the project where you want to export the Login Configurations and User Groups.
Click on Export login configurations to export your Login Configuration created under the current project. Additionally, you can export also the User Groups by clicking on the Export groups button.
Import Login Configurations and User Groups
Go to Affinidi Portal and log in to the Affinidi Portal using your Affinidi Vault.
Go to Affinidi Login service and click on dropdown button called Actions. Make sure that you have selected the project where you want to import the Login Configurations and User Groups.
Click on Import login configurations to import your Login Configuration created under the current project. Click on Import groups if you want to import the User Groups to the same project.
Export and Import Using Affinidi CLI
Export and Import functionality is also available using Affinidi CLI. Follow the steps below on how to do this.
Export Login Configurations and User Groups
- You must log in to the Project where you want to export your Login Configurations.
affinidi start
or if you are already logged in and want to switch to another project, use the following command:
affinidi project select-project --project-id <PROJECT_ID>
Export Login Configurations
- Once you log in to the Project, run the following command to export Login Configuration.
affinidi login export-configs --path ~/Downloads/login_configs_backup.json
It will prompt you which Login Configurations you want to export. You can select each Login Configuration using <space>
or click <a>
to select all. Optionally, you can set the parameter -i
, --ids
to list all the Login Configurations IDs to export separated by <space>
.
- Once you have selected the Login Configurations to export, it will generate the export file based on the path provided in the command with the list of Login Configurations.
{
"data": {
"configurations": [
{
"name": "NextJS Basic",
"redirectUris": [
"http://localhost:3000/api/auth/callback/affinidi"
],
"presentationDefinition": {
...
},
"idTokenMapping": [
...
],
"clientMetadata": {
,,,
},
"tokenEndpointAuthMethod": "client_secret_post"
}
]
}
}
Note
Export functionality does not export client credentials like Client ID, Client Secret, and Issuer since they are regenerated once you import your backup file.Export User Groups
- To export the User Groups from the current Project, run the following command.
affinidi login export-groups --path ~/Downloads/user_groups_backup.json
It will prompt you which User Groups you want to export. You can select each User Group using <space>
or click <a>
to select all. Optionally, you can set the parameter -i
, --ids
to list all the User Groups IDs to export separated by <space>
.
- Once you have selected the User Groups to export, it will generate the export file based on the path provided in the command with the list of User Groups.
{
"data": {
"groups": [
{
"groupName": "all_users",
"users": [
"did:key...
]
}
]
}
}
Import Login Configurations and User Groups
To import Login Configuration from a backup file, follow the steps below:
- You must log in to the Project where you want to export your Login Configurations.
affinidi start
or if you are already logged in and want to switch to another project, use the following command:
affinidi project select-project --project-id <PROJECT_ID>
Import Login Configurations
- Once you log in to the Project, run the following command to import Login Configuration.
affinidi login import-configs --path ~/Downloads/login_configs_backup.json
- Once you import the Login Configurations from your backup file, it will regenerate all the Login Configurations, including client credentials and list them on the screen.
Importing login configurations... Imported successfully!
› Warning: Please save the clientSecret somewhere safe. You will not be able to view it again.
{
"configurations": [
{
"ari": "ari:identity:ap-southeast-1:khyg8765-a0b7-89t7-881e-95cd8688a78f:login_configuration/p098u7yg-0i8j-44b5-8b69-ff4273adc8bc",
"projectId": "khyg8765-a0b7-89t7-881e-95cd8688a78f",
"configurationId": "p098u7yg-0i8j-44b5-8b69-ff4273adc8bc",
"name": "NextJS Basic",
"auth": {
"clientId": "<CLIENT_ID>",
"clientSecret": "<CLIENT_SECRET",
"issuer": "<ISSUER>"
},
"redirectUris": [
"http://localhost:3000/api/auth/callback/affinidi"
],
"clientMetadata": {
"name": "NextJS Basic",
"origin": "http://localhost:3000",
"logo": "https://login.affinidi.com/default-client-logo.svg"
},
"creationDate": "2023-11-21T02:11:41Z",
"tokenEndpointAuthMethod": "client_secret_post"
}
]
}
Note
Please reconfigure your applications with the newly created Client ID, Client Secret, and Issuer to prevent interruption to your end-users.Import User Groups
- To import the User Groups from the backup file to the current Project.
affinidi login import-configs --path ~/Downloads/login_configs_backup.json
- Once you have imported the User Groups, it will create the user groups, including the DIDs of the users.
Importing groups... Imported successfully!
{
"groups": [
{
"ari": "ari:identity:ap-southeast-1:khyg8765-a0b7-89t7-881e-95cd8688a78f:group/user_sample",
"groupName": "user_sample",
"projectId": "khyg8765-a0b7-89t7-881e-95cd8688a78f",
"creationDate": "2023-11-21T02:21:19.731Z"
}
]
}
Note
The service will throw an HTTP Error 409 if the user groups you are trying to import already exist in the Project.Glad to hear it! Please tell us how we can improve more.
Sorry to hear that. Please tell us how we can improve.
Thank you for sharing your feedback so we can improve your experience.