Skip to content

Commit

Permalink
Ag refresh native auth token (#938)
Browse files Browse the repository at this point in the history
* return native auth token when refreshing the token

* changelog
  • Loading branch information
andreigiura authored Sep 29, 2023
1 parent 54929e7 commit 0a5b3cd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]

- [Added `getDefaultCallbackUrl` helper](https://github.com/multiversx/mx-sdk-dapp/pull/936)
- [Return native auth token when refreshing the token](https://github.com/multiversx/mx-sdk-dapp/pull/938)

## [[v2.21.0]](https://github.com/multiversx/mx-sdk-dapp/pull/933)] - 2023-09-21

Expand Down
5 changes: 4 additions & 1 deletion src/hooks/login/useLoginService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ export const useLoginService = (config?: OnProviderLoginType['nativeAuth']) => {
...(apiAddress ? { nativeAuthConfig: configuration } : {})
})
);
return nativeAuthToken;
};

// TODO: @StanislavSava verify and maybe refactor to separate function
Expand Down Expand Up @@ -125,10 +126,12 @@ export const useLoginService = (config?: OnProviderLoginType['nativeAuth']) => {
message: Buffer.from(`${address}${loginToken}{}`)
});
const signedMessage = await signMessageCallback(messageToSign, {});
setTokenLoginInfo({
const nativeAuthToken = setTokenLoginInfo({
address,
signature: signedMessage.getSignature().toString('hex')
});

return nativeAuthToken;
};

return {
Expand Down

0 comments on commit 0a5b3cd

Please sign in to comment.