RocketChat / Rocket.Chat.ReactNative

Rocket.Chat mobile clients
https://rocket.chat
MIT License
1.92k stars 1.14k forks source link

[NEW] NextCloud auth #2109

Open loxK opened 4 years ago

loxK commented 4 years ago

Describe the bug

In web client (mobile and desktop) I have the button but not in the android app

Screenshots

Web login: image

Android: signal-attachment-2020-05-12-170829

Devices and Versions

Your Rocket.Chat.Android version: 4.6.4 Your Rocket.Chat Server version: 3.1.1 (stable 3.x snap channel)

Mobile device model and OS version: OnePlus 6T Android 10

diegolmello commented 4 years ago

This repo is deprecated: https://github.com/RocketChat/Rocket.Chat.Android#important---please-read-this-first Transferring to new one.

diegolmello commented 4 years ago

It doesn't work on iOS as well. Nextcloud auth is not implemented yet. Can you ping me on https://open.rocket.chat? I'm @diego.mello. Let's implement this asap. Thanks.

yodatak commented 4 years ago

It could be very cool to have this fonctionality !

loxK commented 4 years ago

I had to go forward and Nextcloud can be configured as Custom OAuth, which is supported by the App.

  1. Firstly create a Custom OAuth in Rocket Chat server settings, copy the Callback URL
  2. Create a new OAuth Client in Nextcloid Security settings, use the Callback URL.
  3. Copy Id and Secret from Nextcloud
  4. In Rocket Chat Server configure the Custom OAuth provider as follows:
    • Enable: checked
    • URL: [your nexcloud base url]
    • Token Path: /apps/oauth2/api/v1/token
    • Token Sent Via: Header
    • Identity Token Sent Via: Same as "Token Sent Via"
    • Identity Path: /ocs/v2.php/cloud/user?format=json
    • Authorize Path: /apps/oauth2/authorize
    • Scope: openid
    • Param Name for access token: access_token
    • Id:  [paste from NextCloud OAuth client configuration]
    • Secret: [paste from NextCloud OAuth client configuration]
    • Login Style: [make your choice]
    • Button Text: [your choice]
    • Button Text Color: [your choice]
    • Button Color: [your choice]
    • Username field: ocs.data.id
    • Email field: ocs.data.email
    • Name field: ocs.data.display-name
    • Avatar field: [leave empty]
    • Roles/Groups field name: ocs.data.groups
    • Merge Roles from SSO: uncheck
    • Merge users: check
    • Show Button on Login Page: check
yodatak commented 4 years ago

Thanks a lot i use your solution @loxK !

yodatak commented 4 years ago

I try to get the merge roles fonctionality work but it don't you have any idea how to do it ?

yodatak commented 4 years ago

I can't find the ocs.data.groups

loxK commented 4 years ago

I don't use that feature. I tried and it made my account to loose the admin role in Rocket Chat. I didn't dig further.

yodatak commented 4 years ago

I don't use that feature. I tried and it made my account to loose the admin role in Rocket Chat. I didn't dig further.

Same for me :+1:

djorkaeffalexandre commented 4 years ago

Nice workaround @loxK! I'll use this to develop the right way and do this working, probably at the next week! Thanks! 😃

darius1810 commented 3 years ago

Hello @djorkaeffalexandre, is there something new ?

czadikem commented 1 year ago

Yeah has this been implemented yet? Or is it in the works?

linusgke commented 1 year ago

Any updates on this? @loxK's workaround didn't work for me!

3ronco commented 4 months ago

All oauth config fields for Nextcloud filled appropiately in RocketChat server settings under https://.../admin/settings/OAuth

Rocket.Chat Version: 6.6.0
     NodeJS Version: 14.21.3 - x64
    MongoDB Version: 5.0.24
        Commit Hash: 92a307ec3d

with Android App Version 4.46.1.57002

No OAuth Button for login in the mobile app only and the following log message when trying to connect:

{"level":40,"time":"...","pid":9,"hostname":"...","name":"DeprecationWarning","section":"API","msg":"The parameter \"query\" in the endpoint \"/api/v1/settings.public\" is deprecated and will be removed on version 7.0.0"}

Login from Web Browser works fine.