Skip to content

Commit

Permalink
modify issue token function
Browse files Browse the repository at this point in the history
Signed-off-by: Musilah <[email protected]>
  • Loading branch information
Musilah committed Nov 4, 2024
1 parent 9884eee commit fd18ace
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 6 deletions.
5 changes: 5 additions & 0 deletions .changeset/twelve-pants-bathe.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@absmach/magistrala-sdk": patch
---

modify issue token function to use identity instead of username
2 changes: 1 addition & 1 deletion examples/users.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ mySdk.users.UserProfile(
})

mySdk.users.CreateToken(
{ username: '<username>', secret: '<password>' }
{ identity: '<username | email>', secret: '<password>' }
)
.then((response: any) => {
console.log('response: ', response)
Expand Down
3 changes: 1 addition & 2 deletions src/defs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,7 @@ export interface ChannelsPage {
}

export interface Login {
username?: string
email?: string
identity?: string
secret?: string
}

Expand Down
2 changes: 1 addition & 1 deletion src/users.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ export default class Users {
// Issue Access and Refresh Token used for authenticating into the system
/**
* @method CreateToken - Issue Access and Refresh Token used for authenticating into the system. A user can use either their email or username to login.
* @param {Object} login - Login object with username, password and email.
* @param {Object} login - Login object with identity and secret. The identity can either be the email or the username of the user to be logged in.
* @returns {Object} - Access, Refresh Token and Access Type.
* @example
* const login = {
Expand Down
3 changes: 1 addition & 2 deletions tests/users.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,8 @@ describe('Users', () => {
}

const login: Login = {
email: '[email protected]',
secret: '12345678',
username: 'fkatwigs'
identity: 'fkatwigs'
}

const tokenObject: Token = {
Expand Down

0 comments on commit fd18ace

Please sign in to comment.