Comment to 'API authentication'
  • Actually such params as password and client id need to be passed as POST params, not GET params, from your documentation it isn't clear how POST params are passed, however, it maybe POST params are passed automatically.  

    To generate key&secret with different grant type you need to generate it usual way in OAuth2 module, then you need to update some params manually via DB:

    UPDATE bx_oauth_clients SET grant_types='password' WHERE client_id='<your client id>';
    UPDATE bx_oauth_clients SET client_secret='' WHERE client_id='<your client id>';

    Then you will be able to get access token using the following CURL command:

    curl -X POST "https://you-una-site-domain/modules/?r=oauth2/token" -d "grant_type=password&scope=basic&client_id=<your client id>&username=<your login email>&password=<your login password>"

    So try to set the following in your config:

    oauth_client_id = "<your client id>"
    oauth_client_secret = ""
    oauth_url = "https://you-una-site-domain/modules/?r=oauth2/token";
    authentication = "oauthbearer"

    oauth_client_secret is empty when password grant type is used

    If it will not work, ask them for the support, or they need to provide more complete documentation.

    • while we are here, I will add another degree of complexity, perhaps this has something to do with it..
      the keypair generated by una oauth2 module and the key pair length generated by rocket chat instance seem to be differing lengths.
      there may be a setting needed to "bring down" the length of the keypair bits value in rocket chat config, but I gave up last month and added the integration to my revolving "to do list" 

      • Please provide me the details about it, Omar Amer , it's very interesting to check it.

        • sorry to have missed this one!

          in short while trying to set up oAuth for rocket chat:

          i noticed the oAuth tokens rocket chat was generating were longer than the oAuth tokens generated by the Una Oauth2 module.

          this suggests a mismatch in key generating algorithms, one weaker, one stronger.

          and for making compatability with both, they would expect the same length keys.  

          :)

          i dont have screenshots handy, this was over a month and a half ago i experienced this.

          LeonidS