• Resolved mlaw93

    (@mlaw93)


    When I try to authorize I get: error=invalid_client_id&error_description=client%20identifier%20invalid

    Any ideas?
    I don’t see a place in settings to enter a client id. I’ve entered everything else on settings.

Viewing 15 replies - 1 through 15 (of 16 total)
  • Plugin Author Jonathan Stegall

    (@jonathanstegall)

    Yes. Usually, Salesforce returns this error during the period of time where the app in Salesforce is still being created. It can take a few minutes, from what I’ve seen. But unfortunately their API doesn’t return anything helpful we can use to tell you that.

    We do have some documentation to that effect here: https://github.com/MinnPost/object-sync-for-salesforce/blob/master/docs/initial-setup.md. I would recommend to make sure your Salesforce app settings are correct inside Salesforce, and if so, wait a bit and try to authorize again.

    Plugin Author Jonathan Stegall

    (@jonathanstegall)

    I should also mention that this error occurs when the Consumer Key from the Salesforce app is stored incorrectly in the WordPress settings.

    For example, I’ve had this happen because the Consumer Key ends with a kind of “-x398” format. Like a special character followed by some more characters. Often if I’m not paying close attention, when I try to copy the whole key it will miss the special character and the characters after it, and thus the plugin will fail to authorize because the pasted key in the WordPress settings is incorrect.

    But more often, as I said earlier, it is because the app in Salesforce has not yet initialized.

    Thread Starter mlaw93

    (@mlaw93)

    Ok, so I have it working..except it takes me to the salesforce login screen. Is that right?

    Plugin Author Jonathan Stegall

    (@jonathanstegall)

    Yes, definitely. Authorizing the plugin requires you to log in to Salesforce and give permission. The user you log in to Salesforce with is where the plugin gets the access capabilities it will have.

    Thread Starter mlaw93

    (@mlaw93)

    I went ahead and entered the credentials, but it just takes me back to the plugin authorize screen and says I still need to authorize

    Plugin Author Jonathan Stegall

    (@jonathanstegall)

    Usually the plugin does a page reload quickly after it gets a response from Salesforce, and then it shows the correct status on that authorize screen.

    If it does not, you can try to reload the page manually, but there may be an error on the Salesforce side. Check server logs to see if there is.

    Thread Starter mlaw93

    (@mlaw93)

    On the Salesforce side, on the app it shows that I have OAuth Connected Apps after I use the “Connect to Salesforce”. And log for auth event shows login Success.

    But authorize tab still shows “Connect to Salesforce” as if I haven’t connected.

    Plugin Author Jonathan Stegall

    (@jonathanstegall)

    It seems that WordPress thinks it has not finished. Click the button again and make sure you’ve completed all these steps:

    1. Click the Connect to Salesforce button (as you’ve done)
    2. You may have to log into Salesforce. (as you’ve done)
    3. Salesforce will ask you to allow access to the app and will show you what permissions it needs. Click Allow.
    4. Wait until you are redirected back to WordPress. Don’t do anything until you see a message that says “Salesforce is successfully authenticated.”
    5. The tab will display a “Disconnect from Salesforce” button which you can click at any time, and will also show a bit of basic information about your Salesforce environment (the available API versions and a basic table of Contacts.)

    If these steps don’t complete, there could be errors on your server.

    Thread Starter mlaw93

    (@mlaw93)

    No luck. I checked my server error logs and I don’t see any activity.

    Maybe its just not meant to be.

    Plugin Author Jonathan Stegall

    (@jonathanstegall)

    Maybe. Where in the above steps does it fail? Are you saying it redirects you back to WordPress (so it gets through step 4), but never reloads to show you the “Salesforce is successfully authenticated” message?

    What versions of PHP and WordPress are you running?

    Thread Starter mlaw93

    (@mlaw93)

    Correct.

    1. I click Connect to Salesforce
    2. It asks me to login
    3. It shows me what permissions are needed
    4. it returns to the wordpress page, reloads authorize tab…but the button still says “Connect to Salesforce”

    PHP Version: 5.6.31-4+wpengine10
    WordPress Version: 4.9.5
    Server Software: Apache

    Plugin Author Jonathan Stegall

    (@jonathanstegall)

    There are two things that could be causing this:

    1. If any of the Salesforce app settings are stored incorrectly in WordPress.
    2. If WordPress is not receiving an authorization token from Salesforce. That is, Salesforce may be doing the authorization correctly but it is not returning the token to WordPress correctly. This value gets stored in the wp_options table under object_sync_for_salesforce_refresh_token so if it is empty, that is the issue.

    Some things to check:

    1. After you are returned to WordPress, to the authorize tab, what URL is being loaded? Does it have any query strings?
    2. Are there any JavaScript errors if you look in your browser console?
    3. What permissions do you have enabled on the Salesforce app? It needs to have Access and manage your data (api) and Perform requests on your behalf at any time (refresh_token, offline_access).

    Thread Starter mlaw93

    (@mlaw93)

    1. For a spit second it does have something on the URL

    options-general.php?page=object-sync-salesforce-admin&tab=authorize&code=aPrxZEB8NmitBYHm3cgyVcacGDPe.ghftVwFat0UbDGItrpMmF3YEoeDiswEyXSbDco0.79qYg%3D%3D

    Then it changes back to one without

    options-general.php?page=object-sync-salesforce-
    admin&tab=authorize

    2. no javascript errors

    3. I added extra thinking that was the issue, but it didn’t help

    Selected OAuth Scopes
    Access and manage your data (api)
    Provide access to your data via the Web (web)
    Full access (full)
    Provide access to custom applications (visualforce)

    — I don’t see any entry in the options table for object_sync_for_salesforce_refresh_token
    — I am running a multisite and this is a subsite…not sure if that makes a difference. but I checked the main wp_options table and the wp_4_options table

    Thread Starter mlaw93

    (@mlaw93)

    just to see what would happen, I put the url param on the end… and I get a message “Error 400: expired authorization code”
    Even if I use it within seconds.

    Plugin Author Jonathan Stegall

    (@jonathanstegall)

    I’d like to investigate this further and test with multisite. I’ve never run the plugin in that environment. I don’t think that should cause any issues, but since I’ve never done it I’m not sure.

    The authorization code definitely will expire as you say, as Salesforce only allows it to be run one time. It is supposed to return a token, which WordPress then saves into that option field.

Viewing 15 replies - 1 through 15 (of 16 total)

The topic ‘can’t authorize’ is closed to new replies.