(Duplicate from the 7.x branch: this impacts both.)

The way Commerce Square requests new OAuth tokens is now deprecated. Although it is currently still supported, the current method being used will eventually stop working. (In fact, if I am reading things right, tokens created via the latest API (version 2019-03-13) may REQUIRE the new method. So, users of the current version of this module may NOT want to update to the latest Square API.)

The following information came via email, and I can't find any copies online to link to, so I'll copy it here:

We recently shipped Square Connect API version 2019-03-13. Along with this release, we have introduced OAuth Refresh Tokens. Refresh Tokens are special-purpose tokens that are used to obtain a new OAuth Access Token when a previous one has expired. Refresh Tokens are used to renew an Access Token at any time as long as the authorization hasn’t been revoked (by the Seller in the Seller Dashboard or a call to the RevokeToken endpoint).

Additionally, we have deprecated the RenewToken endpoint. Developers can now use the same endpoint, ObtainToken, to obtain a new OAuth Access Token with a Refresh Token. RenewToken will continue to work with OAuth Access Tokens created prior to API version 2019-03-13, but any Access Token created after updating to this API version can only be renewed with ObtainToken using a Refresh Token.

To get started using OAuth Refresh Tokens, check out the migration guide.

Links included in the email:
New API Version: https://docs.connect.squareup.com/changelog/authorization-logs/2019-03-13
RevokeToken endpoint: https://docs.connect.squareup.com/api/oauth#endpoint-oauth-revoketoken
RenewToken endpoint: https://docs.connect.squareup.com/api/oauth#endpoint-oauth-renewtoken
ObtainToken endpoint: https://docs.connect.squareup.com/api/oauth#endpoint-oauth-obtaintoken
Migration guide to using RefreshTokens https://docs.connect.squareup.com/authz/oauth/migration

The Change Log entry (rather more terse than the message above):
https://github.com/square/connect-php-sdk/blob/master/CHANGES.md#improve...

Improvement: Simplified OAuth access token renewal
The RenewToken endpoint is now deprecated and replaced with new functionality in ObtainToken. ObtainToken now returns a refresh token along with an access token. Refresh tokens are used to renew expired OAuth access tokens.

For 8.x-1.x-dev, see the POST to /oauth2/clients/{client_id}/access-token/renew in commerce_square_cron() in commerce_square.module. This is the deprecated endpoint.

Comments

DaleTrexel created an issue. See original summary.

vuil’s picture

Priority: Normal » Major

I think that needs to become "Major issue" because the Square API is already updated to v.2, and works with v.2 only.

vuil’s picture

Category: Task » Bug report
mglaman’s picture

Category: Bug report » Task
mglaman’s picture

Status: Active » Postponed

Postponing on the changes in #3075906: Square OAuth authentication failure, update for latest API changes, which might include this.

mglaman’s picture

vuil’s picture

Status: Postponed » Closed (duplicate)

Yes, it is. It should be closed as Closed (duplicate). Thank you.

mglaman’s picture

Assigned: Unassigned » mglaman
Status: Closed (duplicate) » Postponed

ilchovuchkov, I appreciate the effort. But as the maintainer, I do not consider this a duplicate yet.

In fact this might be the proper issue for all of the work since Dale put great information here describing the work and effort.

mglaman’s picture

Status: Postponed » Closed (duplicate)

Yep, this will all go into the other issue.