Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Credential Management API: get resolves to null #6809

Closed
igoj07 opened this issue Sep 21, 2018 · 4 comments
Closed

Credential Management API: get resolves to null #6809

igoj07 opened this issue Sep 21, 2018 · 4 comments
Assignees
Labels
bug has-min-repro Has a minimum reproduction

Comments

@igoj07
Copy link

igoj07 commented Sep 21, 2018

NWJS Version : 0.33.3 SDK
Operating System : Win 7 x64

Expected behavior

I would like to use Credential Management API for auto sign-in feature in my app simply like this:

  1. to store user password credentials
    var creds = new PasswordCredential({ id: "username", password: "password" }); navigator.credentials.store(creds);
  2. to get stored user credentials
    navigator.credentials.get({password: true, mediation: 'silent'}).then(function (creds) { ... });

Actual behavior

Credentials are successfully stored, but calling navigator.credentials.get always resolves to null.

How to reproduce

Try this code:

var creds = new PasswordCredential({id: "user", password: "pass"});

navigator.credentials.store(creds).then(function () {
    navigator.credentials.get({password: true, mediation: 'silent'}).then(function (result) {
        // result = null                             
    });
});

Thank you.

@rogerwang rogerwang self-assigned this Sep 27, 2018
@rogerwang
Copy link
Member

This is fixed in git and will be available in the next nightly build.

@igoj07
Copy link
Author

igoj07 commented Oct 23, 2018

NWJS Version : 0.34.0 SDK
Operating System : Win 7 x64

Thank you for fixing this issue, but it works for local files only, not for remote ones.

How to reproduce

Page index.html contains this code only:

<script>

    var creds = new PasswordCredential({id: "foo", password: "bar"});

    navigator.credentials.store(creds).then(function (success) {
        navigator.credentials.get({password: true, mediation: 'silent'}).then(
           function (storeCreds) {
                ...
           });
    });

</script>

For this package.json it works as expected:

{
  "name": "foo",
  "main": "index.html"
}

But for this one, it doesn´t work:

{
  "name": "foo",
  "main": "http://127.0.0.1:8080/index.html"
}

@rogerwang rogerwang reopened this Oct 23, 2018
@stale
Copy link

stale bot commented Oct 18, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Oct 18, 2019
@stale stale bot closed this as completed Oct 21, 2019
@itm-platform
Copy link

Same here, it logs null

    const credential = new PasswordCredential({
        id: auth.username,
        password: auth.password,
    })
    navigator.credentials.store(credential).then(() => {
        console.info("Credential stored in the user agent's credential manager.", credential); // logs credential
        navigator.credentials.get({
            password: true,
            mediation: 'silent'
        })
            .then(c => console.log(c)); // logs null

@ayushmanchhabra ayushmanchhabra added bug has-min-repro Has a minimum reproduction and removed stale labels Sep 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug has-min-repro Has a minimum reproduction
Projects
None yet
Development

No branches or pull requests

4 participants