Skip to content

Commit

Permalink
remove tld check
Browse files Browse the repository at this point in the history
  • Loading branch information
terryttsai committed Apr 29, 2022
1 parent f56ef81 commit a2005b2
Showing 1 changed file with 1 addition and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,11 @@ exports.onExecutePostLogin = async (event, api) => {
/** 2. Add user's state_code to the app_metadata */
const domainSplit = userDomain.split(".");

const tld = domainSplit[domainSplit.length - 1].toLowerCase();

// assumes the state is always the second to last component of the domain
// e.g. @doc.mo.gov or @nd.gov, but not @nd.docr.gov
const state = domainSplit[domainSplit.length - 2].toLowerCase();

if (tld === "gov" && acceptedStateCodes.includes(state)) {
if (acceptedStateCodes.includes(state)) {
const stateCode = `us_${state}`;
api.user.setAppMetadata("state_code", stateCode);
api.idToken.setCustomClaim(`${namespace}/app_metadata`, {
Expand Down

0 comments on commit a2005b2

Please sign in to comment.