I am trying to update user information in a "Edit Profile" page and while I do save changes into the Audience Manager database using the AM API, the AM claims are not updated. It seems that the AM claims are read only, I cannot overwrite profile extended details claims from code. Therefore how to display the appropriate user details on every page after a profile update has occurred, without forcing the user to logout and login again?
Also, how to cleanup AM claims properly during logout? At the moment even logging out and then logging in again still uses old profile claims information which remain in the ADF cookie. Should I delete the cookie as part of the update profile process? It sounds a bit drastic.
Update 1:
Thanks Peter I am now able to logoff correctly by deleting all AM claims + the internalcontactid claim. Calling contact.IdentifyAsCurrentVisitor() indeed works nicely when logging in as a different user.
So far, I am still not able see the updated claims when changing profile details in a page. Logging off and on again with the same user still shows old claim values, despite deleting all the claims and calling IdentifyAsCurrentVisitor() upon login. I am also calling contact.IdentifyAsCurrentVisitor() right after contact.Save(), is this ok? It does not seem to help anyway.
Update 2:
Adding the ADF claim "taf:cartridge:audiencemanager:invalidatecache" upon profile change, as suggested by Peter, works like a charm! All claims are updated during the following request as expected. Thanks a lot Peter.