A fully open source & end-to-end encrypted note taking alternative to Evernote.
TypeScript asp-net-coredotnet-coreelectronfosshacktoberfestnote-managmentnote-takingnote-taking-appnotebooknotesnotes-appopen-sourceopensourceprivacyproductivityreactreact-nativereactjsself-hosted
feat: add logic to exchange auth code with temp token
thecodrr879f9db7e937
diff --git a/packages/core/api/token-manager.js b/packages/core/api/token-manager.jsindex a4d4455f6..193894223 100644--- a/packages/core/api/token-manager.js+++ b/packages/core/api/token-manager.js@@ -4,6 +4,7 @@ import constants from "../utils/constants";const ENDPOINTS = {token: "/connect/token",revoke: "/connect/revocation",+ temporaryToken: "/account/token",};class TokenManager {@@ -71,5 +72,15 @@ class TokenManager {saveToken(tokenResponse) {return this._db.context.write("token", { ...tokenResponse, t: Date.now() });}++ async getAccessTokenFromAuthorizationCode(userId, authCode) {+ return await this.saveToken(+ await http.post(`${constants.AUTH_HOST}${ENDPOINTS.temporaryToken}`, {+ authorization_code: authCode,+ user_id: userId,+ client_id: "notesnook",+ })+ );+ }}export default TokenManager;