I managed to setup oAuth in RC and the oAuth plugin in Wordpress. The current status is as follows:
- User goes to the login page of RC
- Clicks on the oAuth login button that redirects to the login page of Wordpress on another server and different domain
- Registers a username or logs in as user x.
- Wordpress redirects this user back to the login page of RC
- User has to click on the oAuth login button to access RC
I would like to know how I can redirect an authenticated user directly into the chatbox without the need to click on the oAuth button again.
I do not want to work with iframes if possible. When logged in into the Wordpress site I want to be able to have a menu option called ‘chat’ that, when clicked opens the RC installation running on the other server in a seperate window. I am really close achieving this, but at this moment I still have to click the oAuth button in the login form again.
Somebody online here who has this operational and cares to share?
F.Y.i. I am using a redirect plugin for the redirecting. I never was able to get the redirect_url option of the oAuth plugin itself working. It get’s the token perfectly but redirecting didn’t work at all.
Thanks in advance.
Really? Nobody who has this operational?
I think this is because oauth just does this… you shouldnt need to hack this.
If you must… add login script that checks for query param like you expect and then have it do the click…
But better solution would be to make oauth work like it does for everyone else.
I was thinking of simulating the click as you suggest. I tried every possible setting but I can’t get it to work. I still have to click the oauth button in order to log in.
If you can, i’d try another oauth plugin on wordpress side. Something isn’t right… it should redirect you back to the app. That’s the whole entire point of oauth flow
It redirects you back to the app but to the login screen of it. It doesn’t perform the last step and that’s logging in automatically. When I press the oAuth button it logs in. Can’t I call the login form of Rocket Chat with the parameter that it normally receives when that button is pressed?
I allready tried a couple of different versions and settings in Wordpress but none of them work.
I have now disabled the custom oAuth and used the standard Wordpress oAuth setting in Rocket Chat. Same result. I log in with a user account in Wordpress. Click the link on the homepage that leads to the loginpage of my Rocket Chat server (different domain and server) and it shows the Blue Wordpress button and my custom form fields (in case I still want to login the normal way). I then have to click the blue Wordpress button to login.
If I don’t logout in Wordpress or Rocket Chat and I click the link on the Wordpress page again it will lead me directly into the chatbox.
So the only thing missing is that I do not login automatically the first time.
I am using the latest free version of WP OAuth Server plugin (v3.6.0).
OAuth Server Enabled: yes
Block Unauthenticated Requests to the REST API : no
Grant Types (Global): all checked
Token length: 30
Require Exact Redirect URI: no
Enforce State Parameter: yes
Enable OpenID Connect: no
Access Token Lifetime : 86400
Refresh Token Lifetime : 86400
Authorization code: checked
Redirect uri: https://----.—.nl/_oauth/wordpress (domainname masked)
Client Credential Assigned User: — no user —
Client Scope: basic
did you ever figure this out i need it too.
Yes and no. I can login with Wordpress users in Rocket Chat, but still have to click on the login button before the channels get visible. Rocket Chat support said to me that this is normal behaviour. I don’t have my test setup operational at the moment but I will make a tutorial as soon as I reinstall it.
I have tested succesfully the SSO option between WP and RC. You stil have click a login button in RC though.