node.js - Stormpath post registration handler: can't save custom data to Okta account -


after user registers application, id assigned in local mysql server, , same id registered customdata.id inside corresponding stormpath account.

this worked before migration okta (using express-stormpath version 3.2.0). after migration , update version 4.0.0 same code doesn't work anymore, , can't find reference or documentation know change. there no explicit errors, customdata doesn't appear in new account under "profile", , results undefined if called.

the relevant postregistrationhandler:

postregistrationhandler: function(account, req, res, next) {     account.getcustomdata(function(err, data) {         if (err) {             return next(err);         }         else {             var newaccount = {                 email: account.email,                 isgestore: isgestore,                 stormpath_href: account.href,                 dataiscrizione: new date()             };             db.query('select * utenti email = "'+account.email+'";', function(err,check){                 if(err) throw err;                 if(check==''){                     res.sendstatus(500);                 } else {                     db.query('update utenti set ? email = "'+account.email+'";', newaccount, function(err,result){                         if(err) throw err;                         data.id = check[0].id;                         data.save();                         res.redirect('/regredirect');                     });                 }             });         }     }); }, 

the migration stormpath okta successful , customdata imported correctly. issue presents newly registered accounts.

i have migrated app stormpath okta myself. using java sdk, express nodejs library. can't transition frictionless.

several things come mind possible things check out: - updating "id" field. might reserved field in okta. should profile.id? - see if can use rest api update user. might easier figure out what's wrong going straight api.

first fetch user.

curl -x \ https://<your okta app>.com/api/v1/users/<user id> \   -h 'accept: application/json' \   -h 'authorization: ssws  <your api token>' \   -h 'content-type: application/json'  

try set properties want update, in profile section

  curl -x post \   https://<your okta app>.com/api/v1/users/<user id> \   -h 'accept: application/json' \   -h 'authorization: ssws  <your api token>' \   -h 'content-type: application/json' \   -d '{   "profile": {         "lastname": "johns",         "secondemail": null,         "mobilephone": null,         "emailverificationstatus": "unknown",         "email": "chris.johns@domainium.com",         "stormpathmigrationrecoveryanswer": "what length of string",         "login": "chris.johns@domainium.com",         "firstname": "chris"     } }' 

okta user api reference: https://developer.okta.com/docs/api/resources/users.html


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -