okta / samples-js-angular

samples-js-angular
https://github.com/okta/samples-js-angular
Other
73 stars 149 forks source link

Error when attempting to login #121

Closed sosella closed 3 years ago

sosella commented 3 years ago

Running Windows 10

Today, 08-01-2021:

1) Logged into my developer.okta.com account (dev-okta-domain) 2) Added "http://localhost:8080/" as a Trusted Origin URL 3) Created an application: Client ID: client-id Client authentication: Use PKCE Application Type: Single Page App (SPA) Grant Type: Authorization Code, User Consent: Require consent 4) Opened a Powershell 7.1.3 session 5) cd srcdir 6) git clone https://github.com/okta/samples-js-angular.git 7) cd to srcdir\samples-js-angular 8) Created a testenv file with ISSUER and CLIENT_ID: ISSUER=https://dev-`okta-domain`.com/oauth2/default CLIENT_ID=client-id 9) cd to srcdir\samples-js-angular\custom-login 10) npm install -> installed successfully 11) npm run start -> started successfully 12) Opened an incognito window in chrome browser 13) Entered the URL: http://localhost:8080/ -> the home page appeared 14) Clicked the Login button -> browser loaded http://localhost:8080/login successfully 15) Opened Developer Tools Console 16) Entered my credentials 17) Clicked the Login button -> Got the following error message in the console:

POST https://dev-`okta-domain`.com/api/v1/authn net::ERR_NAME_NOT_RESOLVED zone-evergreen.js:1068

executing "let resultPromise = fn.apply(this, arguments);" :

    function zoneify(fn) {
        return function () {
            let resultPromise = fn.apply(this, arguments);
            if (resultPromise instanceof ZoneAwarePromise) {
                return resultPromise;
            }
            let ctor = resultPromise.constructor;
            if (!ctor[symbolThenPatched]) {
                patchThen(ctor);
            }
            return resultPromise;
        };
    }

What could be the issue?

oleksandrpravosudko-okta commented 3 years ago

Thanks for reaching out @sosella.

A few questions to help troubleshoot the issue:

sosella commented 3 years ago

First of all, thank you for responding and taking a look at this issue.

1) The same error does occur in Edge and Firefox Developer Edition, both in Private Mode

Firefox DE gave a different error message:

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://dev-`okta-domain`.com/api/v1/authn. (Reason: CORS request did not succeed).

I attached a screenshot of my Security API Trusted Origins page.

TrustedOrigins

2) I don't know how to execute requests from the Developer Tools Console. Which DTC? On developer.okta.com or in the Developer Tools in Chrome, etc.? Could you provide more information, or point me to documentation?

3) The hosts file is unchanged (empty except for the comments section).

Thank you for your assistance with this issue.

aarongranick-okta commented 3 years ago

@sosella

https://dev-`okta-domain`.com/

This should be your actual Okta ORG URL, such as https://mycompany.okta.com

sosella commented 3 years ago

That was it. Thank you.