Andrew Wiebe
Andrew Wiebe

Reputation: 221

Azure B2C Custom Policy - Update claims if user alraedy exists

I would like to create a custom signup policy that will check if a user exists and if it does, it will update a claim on the users object. If the user does not exist I would like it to create the user as normal.

As for right now, if a user attempts to signup using an email that already exists for a user I get an error stating "A user with the specified ID already exists. Please choose a different one."

Upvotes: 0

Views: 300

Answers (1)

James_Hamil-MSFT
James_Hamil-MSFT

Reputation: 191

if I'm understanding your question correctly you can use the Graph to do this as referenced here.

Using this line:

https://graph.windows.net/myorganization/users?$filter=signInNames/any(x:x/value eq 'someone')&api-version=1.6

It will return an array. Either with the name or empty if it does not exist.

Upvotes: 0

Related Questions