Skip to content
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

Oauth2 not working in 7.10.4 #5711

Closed
ghost opened this issue Apr 12, 2018 · 4 comments
Closed

Oauth2 not working in 7.10.4 #5711

ghost opened this issue Apr 12, 2018 · 4 comments
Labels
Area: API Issues & PRs related to all things regarding the API Priority:Critical Issues & PRs that are critical; broken core functionality, fatal errors - there are no workarounds Status:Fix Proposed A issue that has a PR related to it that provides a possible resolution

Comments

@ghost
Copy link

ghost commented Apr 12, 2018

Issue

There are two issues here.

The first is on a clean instance of SuiteCRM the only Grant that seems to be generated is Client credential even though Password Grant is selected.

Using the Client credential does not seen to work and results in the following error. Here is a response from Postman.

data

Expected Behavior

Oauth2 authorization should work.

Actual Behavior

Server responds as unsupported_grant_type.

Possible Fix

Steps to Reproduce

Issue 1

  1. On clean instance of Suite 7.10.4 go to admin page -> OAuth2 Clients and Tokens
  2. New Password Client
  3. Enter name and secret and save.
  4. Notice that it shows as Allowed Grant Type:Client Credentials

Issue 2.

  1. On clean instance of Suite 7.10.4 go to admin page -> OAuth2 Clients and Tokens
  2. Create new Client credentials client
  3. Enter name and secret and save.
  4. Use client_id and secret and post to api/oauth/access_token? with parameters descried in documentation

Context

Unable to interact from external application with CRM, an advertised feature that does not work.

Your Environment

  • SuiteCRM Version used: 7.10.4
  • Browser: Firefox 59.0.2 and Chrome 65.0.3325.181
  • Environment name and version (e.g. MySQL, PHP 7):
    • MariaDB 10.0.34
    • php: PHP 7.0.28
  • Operating System and version (e.g Ubuntu 16.04): Ubuntu 16.04.4 LTS
@samus-aran samus-aran added the Area: API Issues & PRs related to all things regarding the API label Apr 19, 2018
@zoltankocsardi
Copy link
Contributor

zoltankocsardi commented May 2, 2018

@LEAP-nishit we've changed the behavior of the API and working on it to make it better.
Could you test it in this branch please? #5806
The methods of sending calls have been changed as well, but there is a documentation for them [ https://github.com/salesagility/SuiteDocs/pull/90 ]

Also, if you are using Postman, there is an easier way to get access token.

Thank you!

@Dillon-Brown Dillon-Brown added the Status:Fix Proposed A issue that has a PR related to it that provides a possible resolution label May 2, 2018
@drwndx
Copy link

drwndx commented May 4, 2018

So how can I get a key to interact with the API until this is fixed? Is there a way to comment out authorization?

@prasadh13
Copy link

Even I am facing the same issue. How to setup using postman? I am unable to generate a new access token using postman. An example would be great.
Thanks!

@Dillon-Brown Dillon-Brown added the Priority:Critical Issues & PRs that are critical; broken core functionality, fatal errors - there are no workarounds label Jun 2, 2018
@gymad
Copy link
Contributor

gymad commented Sep 12, 2018

Hi @prasadh13, in my case I successfully set up the postman and using Password and Client Credentials auth also, using the fallowing steps in my SuiteCRM instance folder:

$ openssl genrsa -out Api/V8/OAuth2/private.key 2048
$ openssl rsa -in Api/V8/OAuth2/private.key -pubout -out Api/V8/OAuth2/public.key
$ sudo chmod 600 Api/V8/OAuth2/p*.key
$ sudo chown www-data:www-data Api/V8/OAuth2/p*.key

also you will need an OAuth2 Client, call the URL:
{Your-SuiteCRM-URL}/index.php?module=OAuth2Clients and add a new Client, for e.g:
image
Postman settings:
Authorization -> Get New Access Token
image
Click: Request Token
image
Click: Use Token

I hope it helps

Reference to the doc site: https://docs.suitecrm.com/developer/api/version-8/configure-suitecrm/
probably needs some update..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: API Issues & PRs related to all things regarding the API Priority:Critical Issues & PRs that are critical; broken core functionality, fatal errors - there are no workarounds Status:Fix Proposed A issue that has a PR related to it that provides a possible resolution
Projects
None yet
Development

No branches or pull requests

7 participants