Error configuring automatic provisioning in Visual Studio Pro 2022 v17.3.6: "Invalid username and password combination"

Kurt K 176 Reputation points
2022-11-15T01:13:07.413+00:00

In my .NET Maui project, this happens when clicking the "Configure Automatic Provisioning" link from the "Build" section under "iOS" in project properties.

First, I chose a "Team". After that the error in the question title appears.

Background:

The Mac build host I am using is the same one that I used when developing a Xamarin.Forms app on Visual Studio 2019.

I added Visual Studio 2022 for the .NET Maui project. I am using the same project name. Also, I copied / copy-edited much of the sharable code I used on Xamarin.Forms.

Using an iPhone 14 simulator works fine in the .NET Maui project.

I ran into trouble when I wanted to deploy to local (cable/wifi connected) iPhone for testing. First I got a "No valid iOS code signing keys found in keychain. You need to request a codesigning certificate from https://developer.apple.com".

That is when I tried to use automatic provisioning to create the certificate.

Note that I was able to deploy to a local iPhone for testing in the Xamarin.Forms project using Visual Studio 2019.

Can you help me with the error I am getting?

Thank you.

Developer technologies .NET .NET MAUI
0 comments No comments
{count} votes

Accepted answer
  1. Wenyan Zhang (Shanghai Wicresoft Co,.Ltd.) 36,436 Reputation points Microsoft External Staff
    2022-11-16T06:29:54.9+00:00

    Hello @Kurt K ,

    For the "Invalid username and password combination" error, you could try to login your account at Apple Developer Portal and check if you enter the Apple ID and password correctly. And update VS to the latest version.
    For the "No valid iOS code signing keys found in keychain. You need to request a codesigning certificate from https://developer.apple.com". error, it's recommended that you can create a development certificate and profile manually, see Manual provisioning for Xamarin.iOS - Xamarin | Microsoft Learn(The doc is about Xamarin, it applies to MAUI as well)

    You can try to use automatic provisioning again. First, please check the type of your Apple Developer account, if it is Individual account, you have to generate an API Key, and login with your API Key information. If it is Enterprise account, you can manage your account, remove and re-add the account (login with the Apple ID and password).
    About how to generate an API Key, you can follow the steps blew: Go to App Store Connect, click User and Access, go to Keys tab, choose App Store Connect API , then generate an API Key. After that, you can open VS and go to Tools-> Options-> Xamarin-> Apple Accounts -> Add-> Individual account, enter your API key. For more details, you can see Creating API Keys for App Store Connect API on developer.apple.com.

    --------Update--------

    why I do not get prompted with Apple ID and password when I choose an Individual Account?

    Since your Apple developer account is an Individual account, you have to generate an API Key, which is an Apple update. You could watch the WWDC video and see the doc above (or follow the steps above) to create API Keys for App Store Connect API.
    Note: Please be careful to save the downloaded key, it can only be downloaded once.

    --------Update--------

    I should delete the existing profile and cert, and then create the cert from within Visual Studio and proceed from there?

    It's suggested that you can open Keychain, go to login-> Certificates, try to find the certificate you need (you created the certificate within the Apple Developer website and install in your Mac), then right-click the certificate, export it as a p12 file. (in your Mac)
    After that, you can open VS (on your Windows machine), go to Tools-> Options-> Xamarin-> Apple Accounts ->View Details->Import Certificate, import the p12 file (it was on your Mac before, you could move to your Windows machine, then import it), then re-open your MAUI project, go to project properties > iOS > Bundle Signing to check if the cer and profile exist and run on your iOS physical device.(make sure pair to Mac)

    There is a simpler solution: After login with the API Key, you can pair to mac, then click the "Configure Automatic Provisioning" again, choose this team (via API).

    In addition, the profiles are in %HOME%\AppData\Local\Xamarin\iOS\Provisioning\Profiles, all certificates are in %HOME%\AppData\Local\Xamarin\iOS\Provisioning\Certificates, you can remove the profile or cer if you want.

    --------Update--------

    For self-signed root error, it usually means that the AppleWWDRCA is out of date or missing. You could open Keychain on your Mac, go to Login->Certificates, then check if there is a certificate named "Apple Worldwide Developer Relations Certificate Authority" or if it is missing.
    And you can open Apple PKI - Apple, and download Worldwide Developer Relations - G1 (Expiring 02/07/2023 21:48:47 UTC) or other cer you prefer to, then double-click the cer to install into your Mac.
    After that, you can pair to Mac, and try the second simpler solution again.

    --------Update--------

    "Apple Development: Created via API (XXXX)" cert "is not trusted"

    You could double click this cer and go to Trust section, and make sure the “When using this certificate” popup is set to “Use System Defaults” and all the other popups are set to “no value specified

    The AppleWWDRCA in the "System" keychain. The Keychain Access App says that the AppleWWDRCA expires Feb 7, 2023.

    According to your description, you could download another Worldwide Developer Relations - G3 (Expiring 02/20/2030 00:00:00 UTC) and install into your Mac, then check if the Apple Development certificate above is valid. (Both two cers will be in Login or the new cer will be in Login)
    For more details, you can refer to WWDR Intermediate Certificate Expiration - Support - Apple Developer

    Best Regards,
    Wenyan Zhang


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.