mirror of
https://github.com/absmach/supermq.git
synced 2026-06-23 07:30:25 +00:00
NOISSUE - Add Domains to the SDK (#45)
* add: domains sdk Signed-off-by: Arvindh <arvindh91@gmail.com> * fix: error Signed-off-by: Arvindh <arvindh91@gmail.com> * fix: cli users token and refresh Signed-off-by: Arvindh <arvindh91@gmail.com> * fix: cli provision Signed-off-by: Arvindh <arvindh91@gmail.com> * add domains cli Signed-off-by: Arvindh <arvindh91@gmail.com> * remove test program Signed-off-by: Arvindh <arvindh91@gmail.com> * update cli command for list domains Signed-off-by: Arvindh <arvindh91@gmail.com> * add list user domain cli cmd Signed-off-by: Arvindh <arvindh91@gmail.com> * fix varaible naming Signed-off-by: Arvindh <arvindh91@gmail.com> * fix: comments grammar & varabile; add package headers Signed-off-by: Arvindh <arvindh91@gmail.com> --------- Signed-off-by: Arvindh <arvindh91@gmail.com>
This commit is contained in:
+2
-6
@@ -142,15 +142,11 @@ func createUser(s sdk.SDK, conf Config) (string, error) {
|
||||
Status: sdk.EnabledStatus,
|
||||
}
|
||||
|
||||
pass := user.Credentials.Secret
|
||||
|
||||
user, err := s.CreateUser(user, "")
|
||||
if err != nil {
|
||||
if _, err := s.CreateUser(user, ""); err != nil {
|
||||
return "", fmt.Errorf("unable to create user: %w", err)
|
||||
}
|
||||
|
||||
user.Credentials.Secret = pass
|
||||
token, err := s.CreateToken(user)
|
||||
token, err := s.CreateToken(sdk.Login{Identity: user.Credentials.Identity, Secret: user.Credentials.Secret})
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("unable to login user: %w", err)
|
||||
}
|
||||
|
||||
@@ -90,7 +90,7 @@ func Provision(conf Config) error {
|
||||
var err error
|
||||
|
||||
// Login user
|
||||
token, err := s.CreateToken(user)
|
||||
token, err := s.CreateToken(sdk.Login{Identity: user.Credentials.Identity, Secret: user.Credentials.Secret})
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to login user: %s", err.Error())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user