Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

documentation for InvalidAccessError? #2

Closed
apowers313 opened this issue Apr 13, 2016 · 5 comments
Closed

documentation for InvalidAccessError? #2

apowers313 opened this issue Apr 13, 2016 · 5 comments

Comments

@apowers313
Copy link

When running the following code:

var Helpers = {
    account: {
        default: {
            rpDisplayName: "ACME Corporation",
            displayName: "John P. Smith",
            name: "john.p.smith@example.com",
            id: "5757dfa7-c89d-4ff5-a820-b8a6cbdea281",
            imageURL: "http://www.gravatar.com/avatar/205e460b479e2e5b48aec07710c08d50"
        },
    },
    cryptoParameters: {
        default: {
            type: 'ScopedCred',
            algorithm: 'RSASSA-PKCS1-v1_5'
        }
    },
    attestationChallenge: {
        default: "a76262397000461a8feae698b1a9712714e9aa740ddf4073901a30b9e2aa5a59"
    }
};


    window.webauthn.makeCredential(Helpers.account.default, Helpers.cryptoParameters.default, Helpers.attestationChallenge.default, undefined, undefined, undefined)
      .then(function(result) {
        console.log("Promise resolved successfully:", result);
        done();
      })
      .catch(function(err) {
        // assert.fail("no error", err, "Promise should not have failed");
        console.log("promiseResolveSuccess Error:", err);
        done(err);
      });

I get the result: "promiseResolveSuccess Error: InvalidAccessError". It's not entirely clear to me whether this is because Hello is misconfigured / unavailable; some sort of db error; or something else entirely.

Any hints as to how to resolve this error?

@adrianba
Copy link
Owner

The cryptoParameters.default should be an array:

    cryptoParameters: {
        default: [{
            type: 'ScopedCred',
            algorithm: 'RSASSA-PKCS1-v1_5'
        }]
    },

@apowers313
Copy link
Author

It's actually passing in Helpers.cryptoParameters.default which is an array.

(Not that you care, but the reason for that is that there will soon be other cryptoParameters other than .default such as .badType or .badAlgorithm)

@adrianba
Copy link
Owner

Your code snippet above doesn't pass an array. When I copy your code and make the modification in my comment above to change it into an array then the code runs and I see the makeCredential prompt.

@apowers313
Copy link
Author

Sorry, I see what you're saying now... I thought it was already an array. Let me verify and get back to you.

@apowers313
Copy link
Author

That did the trick, thanks again and sorry for the silly question.

For anyone playing along from home, msCredential docs can be found here (although error conditions are still underspecified, just as they are in the W3C spec -- w3c/webauthn#53 :).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants