Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

Problems with using Nextcloud OAuth trough Generic OAuth connector (ID Token not present in token response) #2392

Closed
dmigis opened this issue Sep 8, 2020 · 10 comments · Fixed by #3094

Comments

@dmigis
Copy link

dmigis commented Sep 8, 2020

Question
I'm struggling to make wikijs working with Nextcloud as OAuth provider via Generic OpenID/OAuth connector. After successful redirection to Nextcloud login page and granting access Wikijs throws me an "ID Token not present in token response" error. In wikijs logs there is no error, nginx and nextcloud logs show, that token was received, but user data wasn't requested. Other services with Nextcloud as OAuth provider (Jupyterhub, Vouch proxy and so on) working okay. Is it a bug or I'm doing something wrong?

2020-09-08_10-23

Host Info (please complete the following information):
OS: Docker
Wiki.js version: 2.5.126
Database engine: Postgres 11

@dmigis dmigis added the help label Sep 8, 2020
@tionis
Copy link

tionis commented Sep 14, 2020

I have the same problem when trying to use Gitea as oAuth provider. Same config works fine for other applications using it as oAuth provider.

@maznu
Copy link

maznu commented Sep 17, 2020

Same problems here with our own home-grown OIDC auth endpoint.

I can see wiki.js making a POST to our token endpoint, which responds something like this:

{"access_token": "blahblahblah", "token_type": "Bearer", "scope": "openid openid profile email", "refresh_token": "blahblahblah", "expires_in": 3600}

But it doesn't get as far as making a request to our userinfo endpoint.

@Doctacosa
Copy link

I'm getting the same results.

OS: Docker
Wiki.js version: 2.5.170
Database engine: Postgres 11

My homegrown endpoint appears to be working fine, as I'm able to obtain the proper tokens by using a third-party tool like Postman, but Wiki.js fails with the error described above. I can't think of any alternative to make this work.

@cse342
Copy link

cse342 commented Nov 16, 2020

I am also affected by this issue.

OS: Ubuntu Server 20.04.1 LTS
Database: Postgres 12
Wiki.js: 2.5.170

I tried it with Nextcloud and with a Forum based on Woltlab Burning Board with an Addon called "Oauth 2.0 Server".
In both cases I receive the message "ID Token not present in token response" upon granting access on the openid server.
If I checked correctly, the underlying library is passport-openidconnect, the file in charge is lib/strategy.js. If I looked it up correctly, this library hasn't received an update in nearly 4 years.

@daniel-illi
Copy link

I have the same problem.

I think wiki.js implements the OAuth 'implicit flow' to get the access token: the auth server returns the token immediately.
But all clients I used so far implement the 'authorization code' flow where the auth server returns an authorization code, which the client in turn uses to request the token from the auth server.

@Doctacosa
Copy link

I think wiki.js implements the OAuth 'implicit flow' to get the access token: the auth server returns the token immediately.

That's an interesting idea, I wasn't aware of the difference. Checking through the documentation of my PHP OAuth library (league/oauth2-server), the implicit workflow would have the client send a response_type of token, while the authorization flow would use code. Testing on Wiki.js, it sends code, implying that it's the authorization workflow being used.

I don't pretend to be super familiar with OAuth, so if someone else could chime in on this, it would be nice!

@daniel-illi
Copy link

daniel-illi commented Dec 15, 2020

After having another look, I realize that I was mistaken.

The error message reads "ID token not present in token response".
The wiki.js OAuth module expects the token endpoint response to include an JWT id token.

But when I inspect the browser requests in the developer console, I see that the redirect from the authorize endpoint triggers this error even before querying the token endpoint.
From my understanding, wiki.js should read the code from the redirect, call the token endpoint with the code and receive the access token and maybe an id token.

So something seems to be wired incorrectly.

@assada
Copy link

assada commented Jan 20, 2021

Same issue with oauth2 login. Looks like wiki.js support only OpenID type of OAuth2 protocol. =(

@troedel2546
Copy link

Same for me here with trying to connect to Mattermost as OAuth provider.

artur-shaik added a commit to artur-shaik/wiki that referenced this issue Feb 17, 2021
This PR shoul fix requarks#2392. Used `passport-oauth2` strategy.
@mariosgit
Copy link

Just run into the same problem, the callback to https://wikijsthing/login/71ece951-xxx/callback?state=something&code=somestuff crashes with 500 server error. I do not see any token call, I guess this should be done under the hood.

@NGPixel NGPixel closed this as completed Mar 21, 2021
@requarks requarks locked and limited conversation to collaborators Mar 21, 2021
NGPixel pushed a commit that referenced this issue Oct 16, 2021
* OAuth2 authentication implementation

This PR shoul fix #2392. Used `passport-oauth2` strategy.

* indentations cleanup

* cleanup code
jionggyu pushed a commit to jionggyu/wiki-2.5.302-patch that referenced this issue Jul 9, 2024
* OAuth2 authentication implementation

This PR shoul fix requarks#2392. Used `passport-oauth2` strategy.

* indentations cleanup

* cleanup code

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

10 participants