Have your say in Community Polls: What was/is your greatest motivation to start your own business?
Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

Third party user verification and login

Third party user verification and login

Knofan
Tourist
15 0 2

Hey guys!

 

Im about to implement BankID, an way to idenitfy a user in Sweden and Denmark. This is not an app in the normal sense and it does not integrate with shopify like a normal third party app would. There is no "install button" so to speak. 

 

We use javascript to make calls to the serivce and when the user has identifed him self the service returns an answer on who this person is. Then i will either create a customer profile if it does not alreay exist or, log the user into an existing. 

 

My dilemma is where to put the code to this. I have looked around a little but have not found a great example. Any ideas or perhaps someone can point me in the right direction? 

 

Thanks !

Replies 2 (2)

Liam
Community Manager
3108 344 892

Hi Knofan,

 

How would the customer identify themselves? If this needs to be on a customer account page, you may need to look into using a customer account extension to achieve this, but this is still in developer preview. What format is the code in that BankID has provided? 

Liam | Developer Advocate @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

Knofan
Tourist
15 0 2

Hi Liam

 

I made a test page on my site to see that the button apear and the service was called. The result is a popup window with QR-code. This code is read by an app in a phone, a code is provided (or face id) by the phone owner. If the user is identified then the serivce returns information about him/her. 

 

Knofan_0-1721473164478.png

 

Here are several services that encapsulates this functionallity for faster implementation and that is what im using. You can read more here how it works with java script for example. JavaScript - Integrations - Criipto Verify Documentation

 

One can also use the api from bankid directly but there is alot more coding to be done in that case. even tho it will be "cleaner".

Here is one example of an user Authorization

 

 

<script type="text/javascript">
  document
    .getElementById('login-button-popup')
    .addEventListener('click', () => {
      criiptoAuth.popup
        .authorize({
          width: 300,
          height: 400,
          redirectUri: 'http://localhost:8000/example/index.html',
          acrValues: 'urn:grn:authn:dk:mitid:substantial',
        })
        .then((result) => {
          console.log(result, result.id_token, result.claims);
          document.getElementById('result').textContent =
            JSON.stringify(result);
        });
    });
</script>