Azure-Samples / active-directory-verifiable-credentials

A code sample demonstrating how to use Azure Active Directory's preview functionality to issue and consume verifiable credentials.
107 stars 64 forks source link

QR Code Got Expire ? with azure verifiable credential #63

Closed maulikhdave9601672767 closed 1 year ago

maulikhdave9601672767 commented 1 year ago

0

I used "https://verifiedid.did.msidentity.com/v1.0/verifiableCredentials/createIssuanceRequest" api to generate my QR Code Response is

{ "requestId": "799f23ea-5241-45af-99ad-cf8e5018814e", "url": "openid://vc?request_uri=https://verifiedid.did.msidentity.com/v1.0/12345678-0000-0000-0000-000000000000/verifiableCredentials/request/178319f7-20be-4945-80fb-7d52d47ae82e", "expiry": 1622227690, "qrCode": "data:image/png;base64,iVBORw0KggoA" }

but the issue is my QRcode get expire in 5 mins ?

any help on this.....

cljung commented 1 year ago

This is the expected behaviour that the QR code is only valid for 5 minutes. It is not and issue. Please use stackoverflow for developer related questions and use tag #azure-ad-verifiable-credentials and it will get answered there

maulikhdave9601672767 commented 1 year ago

Sure i will do it but can you just give small information will it be possible to increase 5 min to 24 hours??

mahoekst commented 1 year ago

not possible. you need to refresh the QR code or build something which is a static QR code which creates the request on the fly. I am actually working on a sample for that. This way you can use a static QR code for a specific issuance flow.

maulikhdave9601672767 commented 1 year ago

https://github.com/Azure-Samples/active-directory-verifiable-credentials-dotnet/blob/main/3-asp-net-core-api-b2c/ApiVerifierController.cs on this file Line 176

var resp = new { requestId = correlationId, url = string.Format("openid://vc/?request_uri={0}/presentation-request-proxy?id={1}", GetApiPath(), correlationId), expiry = (int)(DateTime.UtcNow.AddDays(1) - new DateTime(1970, 1, 1)).TotalSeconds, id = correlationId };

            i tried change this but no success can you help me what change will work ??
mahoekst commented 1 year ago

You can not modify the expiry of the VC issuance request.

mahoekst commented 1 year ago

Can you explain why you want this to be 24 hours instead of 5 minutes?

maulikhdave9601672767 commented 1 year ago

i want to use hard copy of this QR code rather then put online on site. like i will take print and take copy of that image and want to set some where as hard copy.. can you tell how it will be possible ?

mahoekst commented 1 year ago

yes is possible but in a different way. I am building a sample as we speak. but what it does: azure function with fixed URL. That URL is put into a QR code with openid-vc://?request_uri= put in front of it, The azure function is calling the VC Request API and downloads the request from the returned URL and returns the content of that download back as return value for the azure function. So whenever you scan the QR code it creates a new issuance request which is then streamed back to the users wallet.

mahoekst commented 1 year ago

it is important to understand what kind of VC you are issuing. If its an ID token flow you should be ok. If it is idtokenhint with fixed values its ok too. But if the data is dynamic you can probably not use this trick

maulikhdave9601672767 commented 1 year ago

I m using https://github.com/Azure-Samples/active-directory-verifiable-credentials-dotnet/tree/main/1-asp-net-core-api-idtokenhint code and made change in verifiable controller Line number 150

var cacheData = new { status = "notscanned", message = "Request ready, please scan with Authenticator", expiry = (int)(DateTime.UtcNow.AddDays(1) - new DateTime(1970, 1, 1)).TotalSeconds i made change here but its not working

mahoekst commented 1 year ago

what do you want to store in the VC?

maulikhdave9601672767 commented 1 year ago

Like Id name address phone email id so only basic information

mahoekst commented 1 year ago

So that data is not the same for every user? you cannot use the idtokenhint since that QR code points to a request which includes that data. If you have your users sign-in through OIDC you could use a static QR code with the trick I mentioned. But you need to have all that data in the ID tokens from that IDP

maulikhdave9601672767 commented 1 year ago

no like i will have 200 users who are going to use same QR code with Hard copy and in call back url we will have our own business logic so can you tell which one will help me and how? which application will help me here i want to use azure VC for this

mahoekst commented 1 year ago

Are all those 200 users using the exact same data in the VC?

maulikhdave9601672767 commented 1 year ago

No all will have their own VC digital card with thier own meta data like ID phone email Name

maulikhdave9601672767 commented 1 year ago

do you have any inputs for me >??

maulikhdave9601672767 commented 1 year ago

Hello @mahoekst any update

maulikhdave9601672767 commented 1 year ago

@mahoekst ay idea on this?>>

mahoekst commented 1 year ago

What you want is not possible. Since the VC payload is different for every user.