OAuth 2.0 support


(Lachlan Cunningham) #1

Hey Guys,

 

Quick one - does the 'REST Resource OAuth Session' asset support OAuth version 2.0? Some quick searching suggests it may only support version 1. Can anyone confirm?

 

I am on Matrix v4.14.3 and attempting to use a Salesforce (force.com) REST API.

 

Cheers,

Lockie


(Lachlan Cunningham) #2

Hey Guys,

 

I've since realised that an OAuth 2 Token asset was added in a later version of Matrix, which luckily I have access to and can use.

 

The authentication now appears to be working - the token asset stores the token and my REST resource is pulling the JSON as expected.

 

I'm now running into an issue where my JSON Data Source asset is throwing a Matrix warning ('Events' is the name of the JSON Data Source asset):

MySource Warning Syntax error: Events (Id: #214222)

 

The JSON in the REST resource is valid (after checking 'Run Test'), so I'm not sure what the issue is here. The JSON Data Source asset is displaying nothing when I check the 'View JSON Data' page and it won't load any shadow assets in the asset map, with error "Error while requesting".

 

Any suggestions?


(Lachlan Cunningham) #3

I've gotten around my previous issue by using the URI of the REST Resource asset in the JSON Data Source, rather than the asset ID.

 

Bigger problem now - The re-fetch of an access token with the refresh token does not appear to be invoked if the REST Resource is retrieving a 401 Unauthorised. I had a quick poke in packages/oauth2/oauth2_token/oauth2_token.inc and it looks like the refresh token is only invoked when the expire time is reached, not when a 401 is returned. In my case, an expire_time is not present, so a refresh can only happen if a 401 is returned. Can anyone verify?