tomasmcguinness / dotnet-passbook

A .Net Library for generating Apple Passbook (Wallet) files for iOS. Please get involved by creating pull requests and opening issues!
MIT License
319 stars 117 forks source link

Authentication error when trying to install Pass from email #3

Closed avilevy closed 12 years ago

avilevy commented 12 years ago

Hi Tomas,

I am trying to use your code to generate a pass and subsequently mailing it to an iPhone (release version of IOS6). The pass is generated without a glitch and shows up in the mail attachment on the iPhone and opens correctly as a Pass. However when trying to 'add' it to Passbook, the console shows these errors.

Sep 21 21:26:24 iPhone-4S passd[219] : Sep 21 21:26:24 SecTrustEvaluate [leaf AnchorSHA1 AnchorTrusted SubjectOrganizationalUnit] Sep 21 21:26:24 iPhone-4S passd[219] : Invalid data error reading card pass.com.ticket.event/012345678910. The passTypeIdentifier or teamIdentifier provided may not match your certificate, or the certificate trust chain could not be verified.

I checked my thumbprint and installed the root, the dev relations and pass type certs in the personal certificate store on my developer machine (windows) after creating a pass type ID. Copied the thumbprint from the certificate store to web.config. Adjusted references to the pass type id.

Any ideas where this is going wrong? Tried to fix this for an entire day, no improvements....

tomasmcguinness commented 12 years ago

Hi Avilevy,

as coincidence would have it, I've just spend the last hour updating my code.

I've corrected the signing logic so that it includes a reference to the Apple Certificate.

The second thing to note is that the Team Identifier must now match the value in the certificate. You can find this by looking in the provisioning portal, under your Passbook certificate. It's a random set of numbers and letters before your passTypeIdentifier.

Please get the latest code and give it another try.

avilevy commented 12 years ago

Tomas,

That solved it! Thank you for sharing your code.

balexandre commented 12 years ago

Hi Tomas and Avilevy,

I don't get the new sign code as you now have 2 different thumbprints (one in web.config and other in AppleCert), do we need to create 2 certificates? Where do we get the second? is just a second Apple Certificate, or it's a special one?

By the way, I have extended the code to support full flexibility in the pass.json and even added all pass examples as well a new Web UI, but I can't get pass this secondary certificate.

Thanks.

improved web UI

tomasmcguinness commented 12 years ago

Hi Bruno,

The 2nd Thumbprint represents Apple’s WWDR certificate. You can download it from here:

http://www.apple.com/certificateauthority/

Grab the “developer relations” one. Alternatively you can download it from the Provisioning Portal under the Certificates section.

This was a new requirement added with the GM of iOS Beta 6 and my code changes form the basis of the certificate chain.

Hope that helps. Let me know if you’re still stuck.

Tom

Sent from Windows Mail

From: Bruno Alexandre Sent: ‎22‎ ‎September‎ ‎2012 ‎14‎:‎34 To: tomasmcguinness/dotnet-passbook CC: Tomas McGuinness Subject: Re: [dotnet-passbook] Authentication error when trying to install Pass from email (#3)

Hi Tomas and Avilevy,

I don't get the new sign code as you now have 2 different thumbprints (one in web.config and other in AppleCert), do we need to create 2 certificates? Where do we get the second? is just a second Apple Certificate, or it's a special one?

By the way, I have extended the code to support full flexibility in the pass.json and even added all pass examples as well a new Web UI, but I can't get pass this secondary certificate.

Thanks.

— Reply to this email directly or view it on GitHub.

balexandre commented 12 years ago

Hi Thomas,

Got it, thanks, but something weird is going on with my attempts. All the passes I create, when opened by iOS6 mail app, I can't add to Passbook, but using the iOS Simulator, they are added with no problems at all:

Do you know what might cause the problem?

Bishbulb commented 12 years ago

If you download the pass on a normal browser and unzip the package, are all of the images located in the same folder? I had an issue where my images were being put into a subfolder inside the .pkpass archive which caused a failure.

The other thing to check is whether you have an icon.png image included (apparently its mandatory, but I couldn't find documentation of that anywhere in the docs).

Dan

Sent from my iPhone

On Sep 22, 2012, at 3:26 PM, Bruno Alexandre notifications@github.com wrote:

Hi Thomas,

Got it, thanks, but something weird is going on with my attempts. All the passes I create, when opened by iOS6 mail app, I can't add to Passbook, but using the iOS Simulator, they are added with no problems at all:

Do you know what might cause the problem?

— Reply to this email directly or view it on GitHub.

tomasmcguinness commented 12 years ago

I'd suggest connecting the device to XCode and seeing the console? That might give you some pointers.

www.about.me/tomasmcguinness

On 22 Sep 2012, at 20:26, "Bruno Alexandre" notifications@github.com wrote:

Hi Thomas,

Got it, thanks, but something weird is going on with my attempts. All the passes I create, when opened by iOS6 mail app, I can't add to Passbook, but using the iOS Simulator, they are added with no problems at all:

Do you know what might cause the problem?

— Reply to this email directly or view it on GitHub.

tomasmcguinness commented 12 years ago

Was that issue of the nested folder issue within my code?

www.about.me/tomasmcguinness

On 22 Sep 2012, at 20:56, "Dan Bishop" notifications@github.com wrote:

If you download the pass on a normal browser and unzip the package, are all of the images located in the same folder? I had an issue where my images were being put into a subfolder inside the .pkpass archive which caused a failure.

The other thing to check is whether you have an icon.png image included (apparently its mandatory, but I couldn't find documentation of that anywhere in the docs).

Dan

Sent from my iPhone

On Sep 22, 2012, at 3:26 PM, Bruno Alexandre notifications@github.com wrote:

Hi Thomas,

Got it, thanks, but something weird is going on with my attempts. All the passes I create, when opened by iOS6 mail app, I can't add to Passbook, but using the iOS Simulator, they are added with no problems at all:

Do you know what might cause the problem?

— Reply to this email directly or view it on GitHub.

— Reply to this email directly or view it on GitHub.

balexandre commented 12 years ago

I'd suggest connecting the device to XCode and seeing the console? That might give you some pointers.

nothing there, and the passes are added normally into Passbook App if I use the Simulator :-/

my code: https://github.com/balexandre/dotnet-passbook

Bishbulb commented 12 years ago

No, it was with my implementation of DotNetZip, which I used since I am still using VS2012. Sorry for the confusion.

Dan

Sent from my iPhone

On Sep 22, 2012, at 4:04 PM, Tomas McGuinness notifications@github.com wrote:

Was that issue of the nested folder issue within my code?

www.about.me/tomasmcguinness

On 22 Sep 2012, at 20:56, "Dan Bishop" notifications@github.com wrote:

If you download the pass on a normal browser and unzip the package, are all of the images located in the same folder? I had an issue where my images were being put into a subfolder inside the .pkpass archive which caused a failure.

The other thing to check is whether you have an icon.png image included (apparently its mandatory, but I couldn't find documentation of that anywhere in the docs).

Dan

Sent from my iPhone

On Sep 22, 2012, at 3:26 PM, Bruno Alexandre notifications@github.com wrote:

Hi Thomas,

Got it, thanks, but something weird is going on with my attempts. All the passes I create, when opened by iOS6 mail app, I can't add to Passbook, but using the iOS Simulator, they are added with no problems at all:

Do you know what might cause the problem?

— Reply to this email directly or view it on GitHub.

— Reply to this email directly or view it on GitHub.

— Reply to this email directly or view it on GitHub.

tomasmcguinness commented 12 years ago

Have you tried opening the passes using the Lion mail app? In the latest update, 10.8.2, it’s possible for OS X to open the passes.

I’d suggest downloading the pass and opening it directly. OS X will log any problem it encounters - this will show you how to use the log - http://geekswithblogs.net/MobileLOB/archive/2012/07/24/debugging-passkit-install-on-ios-simulator.aspx

A thought has just occurred to me...could there be a case sensitivity issue in a file name or something? The Simulator might be more forgiving than the device.

Tom

Sent from Windows Mail

From: Bruno Alexandre Sent: ‎22‎ ‎September‎ ‎2012 ‎20‎:‎26 To: tomasmcguinness/dotnet-passbook CC: Tomas McGuinness Subject: Re: [dotnet-passbook] Authentication error when trying to install Pass from email (#3)

Hi Thomas,

Got it, thanks, but something weird is going on with my attempts. All the passes I create, when opened by iOS6 mail app, I can't add to Passbook, but using the iOS Simulator, they are added with no problems at all:

Do you know what might cause the problem?

— Reply to this email directly or view it on GitHub.

balexandre commented 12 years ago

Hi Tom,

I get nothing on the terminal as it does add correctly to Passbook App, but still not on the device.

You said something about the pass.json file, but I find nothing relevant, maybe a new pair of eyes could help, here is my JSON file output:

{
   "description":"My first store pass",
   "passTypeIdentifier":"pass.com.balexandre.boarding-pass",
   "teamIdentifier":"8VXQU4QYD3",
   "formatVersion":1,
   "organizationName":"Starbucks",
   "serialNumber":"12347",
   "suppressStripShine":false,
   "logoText":"Starbucks",
   "balance":100.12,
   "foregroundColor":"rgb(0,0,0)",
   "backgroundColor":"rgb(242,242,252)",
   "storeCard":{
      "secondaryFields":[
         {
            "key":"current-balance",
            "label":"BALANCE",
            "value":100.12,
            "currencyCode":"EUR"
         },
         {
            "key":"nickname",
            "label":"NICKNAME",
            "value":"John's card",
            "textAlignment":"PKTextAlignmentRight"
         }
      ],
      "backFields":[
         {
            "key":"customer-service",
            "label":"Customer Service",
            "value":"(800) 555-0199"
         },
         {
            "key":"terms",
            "label":"Terms and Conditions",
            "value":"Generico offers this pass, including all information, software, products and services available from this pass or offered as part of or in conjunction with this pass (the \"pass\"), to you, the user, conditioned upon your acceptance of all of the terms, conditions, policies and notices stated here. Generico reserves the right to make changes to these Terms and Conditions immediately by posting the changed Terms and Conditions in this location.\n\nUse the pass at your own risk. This pass is provided to you \"asis\" without warranty of any kind either express or implied. Neither Generico nor its employees, agents, third-party information providers, merchants, licensors or the like warrant that the pass or its operation will be accurate, reliable, uninterrupted or error-free. No agent or representative has the authority to create any warranty regarding the pass on behalf of Generico. Generico reserves the right to change or discontinue at any time any aspect or feature of the pass."
         },
         {
            "key":"created-with",
            "label":"Created with",
            "value":".NET Passbook - https://github.com/tomasmcguinness/dotnet-passbook"
         }
      ]
   },
   "barcode":{
      "format":"PKBarcodeFormatPDF417",
      "message":"306672334462487",
      "messageEncoding":"UTF-8",
      "altText":"306672334462487"
   },
   "authenticationToken":"vxwxd7J8AlNNFPS8k0a0FfUFtq0ewzFdc",
   "webServiceURL":"http://192.168.1.59:82/api/"
}

As I said, it adds well using the Simulator, so, not even a warning message is shown, that's why it's been hard to find out the problem :(

Because all of my code is based on your own, and using your base code works lovely, I'm about to re-start my project again, but this time, test every change in the pass.json (as I have add the ability to add our own primaryFields, secondaryFields, auxiliaryFields as well backFields.

Do you find anything out of ordinary in the code above?

Here is my store.pkpass as well the zip version: store.pkpass and store.zip if you want to dig deep.

Thank you.

tomasmcguinness commented 12 years ago

Hi, I've modified the API so it's possible to directly add the various fields using the PassGeneratorRequest object. Have you got the latest build?The pass looks okay, but I'll take a closer look this evening when I get home. Sorry you're having so many issues!

Tomas McGuinness

Check out my blog at http://www.tomasmcguinness.com Follow me on twitter http://www.twitter.com/tomasmcguinness

Date: Wed, 26 Sep 2012 04:29:14 -0700 From: notifications@github.com To: dotnet-passbook@noreply.github.com CC: tomas@tomasmcguinness.com Subject: Re: [dotnet-passbook] Authentication error when trying to install Pass from email (#3)

Hi Tom,

I get nothing on the terminal as it does add correctly to Passbook App, but still not on the device.

You said something about the pass.json file, but I find nothing relevant, maybe a new pair of eyes could help, here is my JSON file output:

{ "description":"My first store pass", "passTypeIdentifier":"pass.com.balexandre.boarding-pass", "teamIdentifier":"8VXQU4QYD3", "formatVersion":1, "organizationName":"Starbucks", "serialNumber":"12347", "suppressStripShine":false, "logoText":"Starbucks", "balance":100.12, "foregroundColor":"rgb(0,0,0)", "backgroundColor":"rgb(242,242,252)", "storeCard":{ "secondaryFields":[ { "key":"balance", "label":"BALANCE", "value":100.12, "currencyCode":"EUR" }, { "key":"nickname", "label":"NICKNAME", "value":"John's card", "textAlignment":"PKTextAlignmentRight" } ], "backFields":[ { "key":"customer-service", "label":"Customer Service", "value":"(800) 555-0199" }, { "key":"terms", "label":"Terms and Conditions", "value":"Generico offers this pass, including all information, software, products and services available from this pass or offered as part of or in conjunction with this pass (the \"pass\"), to you, the user, conditioned upon your acceptance of all of the terms, conditions, policies and notices stated here. Generico reserves the right to make changes to these Terms and Conditions immediately by posting the changed Terms and Conditions in this location.\n\nUse the pass at your own risk. This pass is provided to you \"asis\" without warranty of any kind either express or implied. Neither Generico nor its employees, agents, third-party information providers, merchants, licensors or the like warrant that the pass or its operation will be accurate, reliable, uninterrupted or error-free. No agent or representative has the authority to create any warranty regarding the pass on behalf of Generico. Generico reserves the right to change or discontinue at any time any aspect or feature of the pass." }, { "key":"created-with", "label":"Created with", "value":".NET Passbook - https://github.com/tomasmcguinness/dotnet-passbook" } ] }, "barcode":{ "format":"PKBarcodeFormatPDF417", "message":"306672334462487", "messageEncoding":"UTF-8", "altText":"306672334462487" }, "authenticationToken":"vxwxd7J8AlNNFPS8k0a0FfUFtq0ewzFdc", "webServiceURL":"http://192.168.1.59:82/api/" }

As I said, it adds well using the Simulator, so, not even a warning message is shown, that's why it's been hard to find out the problem :(

Because all of my code is based on your own, and using your base code works lovely, I'm about to re-start my project again, but this time, test every change in the pass.json (as I have add the ability to add our own primaryFields, secondaryFields, auxiliaryFields as well backFields.

Do you find anything out of ordinary in the code above?

Here is my store.pkpass as well: store.pkpass and store.zip if you want to dig deep.

Thank you.

          —

          Reply to this email directly or view it on GitHub.
tomasmcguinness commented 12 years ago

Good morning Bruno, I've downloaded the zip file you provided and renamed it to store.pkpass. I used a small OS X utility from Apple to verify it was signed correctly. I was able to open the pass in OS X and then use iCloud to send it to my iPhone, which opened it successfully. I then deleted the pass. I emailed the pass to myself and opened it successfully. As far as I can make out, the file you have created is perfect! Are you using the GM of iOS 6 and not an earlier beta?

Tomas McGuinness

Check out my blog at http://www.tomasmcguinness.com Follow me on twitter http://www.twitter.com/tomasmcguinness

Date: Wed, 26 Sep 2012 04:29:14 -0700 From: notifications@github.com To: dotnet-passbook@noreply.github.com CC: tomas@tomasmcguinness.com Subject: Re: [dotnet-passbook] Authentication error when trying to install Pass from email (#3)

Hi Tom,

I get nothing on the terminal as it does add correctly to Passbook App, but still not on the device.

You said something about the pass.json file, but I find nothing relevant, maybe a new pair of eyes could help, here is my JSON file output:

{ "description":"My first store pass", "passTypeIdentifier":"pass.com.balexandre.boarding-pass", "teamIdentifier":"8VXQU4QYD3", "formatVersion":1, "organizationName":"Starbucks", "serialNumber":"12347", "suppressStripShine":false, "logoText":"Starbucks", "balance":100.12, "foregroundColor":"rgb(0,0,0)", "backgroundColor":"rgb(242,242,252)", "storeCard":{ "secondaryFields":[ { "key":"balance", "label":"BALANCE", "value":100.12, "currencyCode":"EUR" }, { "key":"nickname", "label":"NICKNAME", "value":"John's card", "textAlignment":"PKTextAlignmentRight" } ], "backFields":[ { "key":"customer-service", "label":"Customer Service", "value":"(800) 555-0199" }, { "key":"terms", "label":"Terms and Conditions", "value":"Generico offers this pass, including all information, software, products and services available from this pass or offered as part of or in conjunction with this pass (the \"pass\"), to you, the user, conditioned upon your acceptance of all of the terms, conditions, policies and notices stated here. Generico reserves the right to make changes to these Terms and Conditions immediately by posting the changed Terms and Conditions in this location.\n\nUse the pass at your own risk. This pass is provided to you \"asis\" without warranty of any kind either express or implied. Neither Generico nor its employees, agents, third-party information providers, merchants, licensors or the like warrant that the pass or its operation will be accurate, reliable, uninterrupted or error-free. No agent or representative has the authority to create any warranty regarding the pass on behalf of Generico. Generico reserves the right to change or discontinue at any time any aspect or feature of the pass." }, { "key":"created-with", "label":"Created with", "value":".NET Passbook - https://github.com/tomasmcguinness/dotnet-passbook" } ] }, "barcode":{ "format":"PKBarcodeFormatPDF417", "message":"306672334462487", "messageEncoding":"UTF-8", "altText":"306672334462487" }, "authenticationToken":"vxwxd7J8AlNNFPS8k0a0FfUFtq0ewzFdc", "webServiceURL":"http://192.168.1.59:82/api/" }

As I said, it adds well using the Simulator, so, not even a warning message is shown, that's why it's been hard to find out the problem :(

Because all of my code is based on your own, and using your base code works lovely, I'm about to re-start my project again, but this time, test every change in the pass.json (as I have add the ability to add our own primaryFields, secondaryFields, auxiliaryFields as well backFields.

Do you find anything out of ordinary in the code above?

Here is my store.pkpass as well: store.pkpass and store.zip if you want to dig deep.

Thank you.

          —

          Reply to this email directly or view it on GitHub.
balexandre commented 12 years ago

Morning,

I'm using iPhone 4 with iOS 6 GM (last version prior to current public release - my phone) as well iPhone 4S with current public release of iOS6 (wife phone).

From both phones, I can open the card but when I press ADD to Passbook, it closes and the top bar (with the clock) flicks color and nothing more happen. If I open the Passbook App, card is not there :(

Well, if you say it works, I would continue, thing is that, if I use your own base code (latest on master branch), I can open and added normally witch is weird :(


I have sent you a pull request, as I have commented all variables, included a new way to handle images (either by the hole folder or/and one by one), added a missing property labelColor and fixed a small bug. I can see on your beta branch you already have locations and I would like to add the changeMessage (it's important if we use the Update part) and maybe later, support for associatedStoreIdentifiers. Let me know if you need more help... love to help!

ghost commented 11 years ago

Can anyone tell me how to add secondary & auxillary fields from the c# code?

tomasmcguinness commented 11 years ago

Sure, the PassGeneratorRequest class defines several List<> fields that you can add Fields too. In this case, use SecondaryFields and AuxiliaryFields. Alternatively, you can use the helper methods AddSecondaryField and AddAuxiliaryFields.

ghost commented 11 years ago

Any example possible in C#? Also I've this: request.ForegroundColor = "rgb(100,10,100)"; request.LabelColor = "rgb(100,10,100)";

But color doens't change.

tomasmcguinness commented 11 years ago

The Readme for this project contains examples of added those fields. The API is the same as the PrimaryField.

With regards to the colours, are you using the latest codebase?

If you're having a specific problem, I'd suggest opening an new issue as this one has already been closed.

ghost commented 11 years ago

Yeah. I am using latest code base.

Sent from my iPhone

On Dec 11, 2012, at 11:51 PM, Tomas McGuinness notifications@github.com wrote:

The Readme for this project contains examples of added those fields. The API is the same as the PrimaryField.

With regards to the colours, are you using the latest codebase?

— Reply to this email directly or view it on GitHub.

tomasmcguinness commented 11 years ago

Hmm, maybe there is a bug in my code. I will investigate as soon as I can.

www.about.me/tomasmcguinness

On 12 Dec 2012, at 16:11, "raf-ampush" notifications@github.com wrote:

Yeah. I am using latest code base.

Sent from my iPhone

On Dec 11, 2012, at 11:51 PM, Tomas McGuinness notifications@github.com wrote:

The Readme for this project contains examples of added those fields. The API is the same as the PrimaryField.

With regards to the colours, are you using the latest codebase?

— Reply to this email directly or view it on GitHub.

— Reply to this email directly or view it on GitHub.

ghost commented 11 years ago

Hi Tom, Any luck on the the color? Do you have item lists for EventTicket secondary & Auxillary files?

Thanks

tomasmcguinness commented 11 years ago

No luck with the colours. Are you using a background image by any chance? In my testing I've found that using a background image changes the field colours and ignores your own settings.

ghost commented 11 years ago

Right. I am using background image. Also, do you have item list of secondary & Auxiliary fields for event pass??