-
Notifications
You must be signed in to change notification settings - Fork 121
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
Application is throwing "Unauthorized" error after successful openid connection #105
Comments
Thank you for reporting the issue. |
Hi, I think sohemokashi and I are having the same issue, so I'll try to clarify it, especially since I can't really find a solution anywhere. This is my code, I think sohemokashi's code is somewhat similar, or at least there is a chance we have made the same mistake.
|
Thanks for looping me in, my issue is different and I’ve worked with Okta
support Person to figure it out. It was related to bluecoat certificate
error where my local machine is throwing error while in server code my code
works fine
Please let me know if you need any other details from my side
Thanks
Sohel
…On Thu, Mar 4, 2021 at 5:23 PM MiepjeMadelon ***@***.***> wrote:
Hi, I think sohemokashi and I are having the same issue, so I'll try to
clarify it, especially since I can't really find a solution anywhere.
I was following this tutorial from the guides:
https://developer.okta.com/docs/guides/sign-into-web-app/nodeexpress/redirect-to-sign-in/
However, when clicking on the button to go to the login page I get a blank
page with only the word 'Unauthorized'. This is from the url:
error=access_denied&error_description=User+is+not+assigned+to+the+client+application.
This is my code, I think sohemokashi's code is somewhat similar, or at
least there is a chance we have made the same mistake.
const { ExpressOIDC } = ***@***.***/oidc-middleware');
// session support is required to use ExpressOIDC
app.use(session({
secret: 'this should be secure',
resave: true,
saveUninitialized: false
}));
const oidc = new ExpressOIDC({
appBaseUrl: 'insert link here',
issuer: 'https://{insert link here}/oauth2/default',
client_id: 'xx',
client_secret: 'yy',
loginRedirectUri: 'http://localhost:3000/authorization-code/callback',
scope: 'openid profile'
});
// ExpressOIDC attaches handlers for the /login and /authorization-code/callback routes
app.use(oidc.router);
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#105 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ASTLZ52LOEH4NTBH2MSK6PTTCAB6RANCNFSM4XCCATMQ>
.
|
@MiepjeMadelon - You may be running against a change in the Okta Admin Console - by new default, your application does not have any users assigned to it (which would lead to the error message you see - the message is accurate). This change is very recent, and our documentation has not yet caught up to it. In the Admin Console, you will have to assign user/groups to your application (for example, adding group "Everyone" to your application will allow all of your users access (but not outside users that haven't been added to your organization). Let us know if that does or does not address the situation. |
@swiftone It does address the situation, thanks! |
I also encountered this error on a freshly cloned sample app using the Okta hosted login page and was able to fix it by modifying the following file: git/samples-nodejs-express-4/node_modules/openid-client/lib/client.js On line 460 you insert the following two lines in the
So before we have:
and after:
It looks like the oidc client library is not adding the client_id and client_secret to the POST body when calling the /token endpoint. I have opened a case with number 01062513 and the support agent should have a recording of a demonstration of the issue and fix. |
internal ref: OKTA-379204 |
The code goes to /authorization-code/callback with state and code querystring but throws "Unauthorized" error after successful openid connection.
The text was updated successfully, but these errors were encountered: