[14:03] <avinashkhatri198> HI Team,
[14:03] <avinashkhatri198> I am using libsecret library and facing problem with ubuntu2004 gnome-keyring
[14:07] <avinashkhatri198> here is my code
[14:07] <avinashkhatri198> #include <libsecret/secret.h>
[14:07] <avinashkhatri198> #include <iostream>
[14:07] <avinashkhatri198> #include <time.h>
[14:07] <avinashkhatri198> #define SCHEMA getSchema()
[14:07] <avinashkhatri198> #define CREDENTIALS_TOKEN_LABEL "ubuntu2004test"
[14:07] <avinashkhatri198> const SecretSchema *getSchema(void)
[14:07] <avinashkhatri198> {
[14:07] <avinashkhatri198>     static const SecretSchema schema = {
[14:07] <avinashkhatri198>         "org.example.credentials",
[14:07] <avinashkhatri198>         SECRET_SCHEMA_NONE,
[14:07] <avinashkhatri198>         {
[14:07] <avinashkhatri198>          {"username", SECRET_SCHEMA_ATTRIBUTE_STRING},
[14:07] <avinashkhatri198>          {NULL, (SecretSchemaAttributeType)0}}};
[14:07] <avinashkhatri198>     return &schema;
[14:07] <avinashkhatri198> }
[14:07] <avinashkhatri198> void putCredentials(std::string username,std::string password)
[14:07] <avinashkhatri198> {
[14:08] <avinashkhatri198>             }
[14:08] <avinashkhatri198>         }
[14:08] <avinashkhatri198>         g_object_unref(item);
[14:08] <avinashkhatri198>     }
[14:08] <avinashkhatri198>     g_list_free(items);
[14:08] <avinashkhatri198>     std::cout << "...All credentials deleted...";
[14:08] <avinashkhatri198> }
[14:08] <avinashkhatri198> int main()
[14:08] <avinashkhatri198> {
[14:08] <avinashkhatri198>     std::cout << "Adding tokens";
[14:08] <avinashkhatri198>     std::cout << "\nEnter new username or type exit :";
[14:08] <avinashkhatri198>     std::string username[] = {"user1", "user2", "user3", "user4", "user5", "user6"};
[14:08] <avinashkhatri198>     std::string password[] = {"pass1", "pass2", "pass3", "pass4", "pass5", "pass6"};
[14:08] <avinashkhatri198>     for (int i = 0; i < 6; i++)
[14:08] <avinashkhatri198>     {
[14:08] <avinashkhatri198>         std::cout << "Adding credentials....\n";
[14:08] <avinashkhatri198>         std::cout << username[i]<<std::endl;
[14:08] <avinashkhatri198>         std::cout << password[i]<<std::endl;
[14:08] <avinashkhatri198> i compiled using g++  ubuntu2004-libsecret.cpp -o test `pkg-config --cflags --libs glib-2.0 libsecret-1`
[14:09] <avinashkhatri198> while running i cant add and remove credentials in user mode when run below shell script
[14:09] <avinashkhatri198> #!/bin/bash
[14:09] <avinashkhatri198> location="/home/avinash/Documents/training/"
[14:09] <avinashkhatri198> EXE_CMD=$location"test"
[14:09] <avinashkhatri198> echo $EXE_CMD
[14:09] <avinashkhatri198> if [ `whoami` = "root" ]
[14:09] <avinashkhatri198> then
[14:09] <avinashkhatri198>         echo "adding in user account: "`logname`
[14:09] <avinashkhatri198>         runuser -l  `logname` -c "$EXE_CMD 2>/dev/null"
[14:09] <avinashkhatri198> else
[14:09] <avinashkhatri198>         $EXE_CMD 2>/dev/null
[14:09] <avinashkhatri198> fi
[14:15] <avinashkhatri198> can anybody help me , i will share the video as well. May be a quick fix ?
[14:41] <avinashkhatri198> helo , is anybody here?
[14:42] <avinashkhatri198> posted thread in forum since no response here
[14:42] <avinashkhatri198> https://ubuntuforums.org/showthread.php?t=2457187