Enabling SSO or Oauth2

Hi i have a workspace which is made in php and has a authentication.

i have provided 1 tab with the name of owncloud and when user clicks on it they get redirected to my owncloud server, where they will be autologged in.

basically using same credentials for my work space and owncloud server

i want my users to authenticate on my workspace and then they get auto logged in on owncloud too

You have to setup oauth2 app in the owncloud server, and then write your client application in such a way that it performs oauth2 handshake with the owncloud server.
Then if the user authenticates to owncloud, they will be logged in to your app too