https://github.com/GuilloryDupre/DNAngulator/blob/main/auth.js
The call to authenticate() is commented out in the live app, because I couldn't get it to work as expected. The login form submission, authcode submission, and checkLogin verification all seem to work correctly (returning "Success" and "Ok" for example)...
But when the app actually does an API call, like getAncestors, it returns the same JSON as if still not logged in. Specifically, it does not return first names of living profiles.
Although, it does return first names of living profiles if the user is logged in to WikiTree Apps via another way (homepage or another app like DNAconf).
So for now, I just have a link to WikiTree Apps homepage as a way to login. But it opens a new tab that doesn't redirect back to the app, so it's not a nice UX.
I hope someone can look at the code and spot what's wrong.
https://apps.wikitree.com/apps/guillory1078/dnangulator/
If this gets solved, I hope we can rewrite the API auth docs to use ES6 (e.g. fetch) instead of the cumbersome XMLHttpRequest and JQuery.