Skip to content
This repository has been archived by the owner on Jun 27, 2022. It is now read-only.

Commit

Permalink
Fix iOS and Android login (#50)
Browse files Browse the repository at this point in the history
* Update login.js

Returning privateKey as null when is not found in the database. Otherwise, Bitwarden Mobile App gets an unexpected error and crashes without any log

* eslint fixes
  • Loading branch information
vvondra authored May 12, 2019
1 parent e6778e0 commit ea25a45
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/login.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,14 +148,15 @@ export const handler = async (event, context, callback) => {
device.set({ refreshToken: tokens.refreshToken });

device = await device.updateAsync();
const privateKey = user.get('privateKey') || null;

callback(null, utils.okResponse({
access_token: tokens.accessToken,
expires_in: DEFAULT_VALIDITY,
token_type: 'Bearer',
refresh_token: tokens.refreshToken,
Key: user.get('key'),
PrivateKey: (user.get('privateKey') || '').toString('utf8'),
PrivateKey: privateKey ? privateKey.toString('utf8') : null,
}));
} catch (e) {
callback(null, utils.serverError('Internal error', e));
Expand Down

0 comments on commit ea25a45

Please sign in to comment.