OAuth2 Library troubleshooting

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

OAuth2 Library troubleshooting

Clarence Martin via use-livecode
Hi folks,
I’m trying to access the Salesforce.com <http://salesforce.com/> REST API from LiveCode via their UserAgent flow https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/intro_understanding_user_agent_oauth_flow.htm <https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/intro_understanding_user_agent_oauth_flow.htm>

...but am struggling with seeding the OAuth2 library to get an authorisation page returned that isn’t blank.

I’m not getting any error messages - just silent failures. I did discover that the redirect_url needed to be secure and so have configured https://localhost <https://localhost/> on my Mac but am now deep in guesswork-land.

The docs are light regarding the OAuth2 library beyond definitions and a single example - and there’s little on the forums. I started a forum thread a few days ago - https://forums.livecode.com/viewtopic.php?f=11&t=31291&p=169196#p169196 <https://forums.livecode.com/viewtopic.php?f=11&t=31291&p=169196#p169196> but I’m guessing this subject is either dead easy (and hence I’m being a numpty!) or very unpopular! :-D

Any clues how I can approach debugging would be greatly appreciated.
Thanks & regards,
Keith

 
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: OAuth2 Library troubleshooting

Clarence Martin via use-livecode
Hi Keith

It is not recommended to use localhost as a redirect. What I tend to do is set up a blank php or jsp on my website and use that as the redirectURL. This url is used to send the token to in a browser request. If the page fails or does not exist then that token is never received. The guide on Salesforce site (the one you linked to) says:
> Salesforce appends access token information to the redirect URL with the following values:
And will look like this:
1
https://www.mysite.com/user_callback.jsp#access_token=00Dx0000000BV7z%21AR8
2
AQBM8J_xr9kLqmZIRyQxZgLcM4HVi41aGtW0qW3JCzf5xdTGGGSoVim8FfJkZEqxbjaFbberKGk
3
8v8AnYrvChG4qJbQo8&refresh_token=5Aep8614iLM.Dq661ePDmPEgaAW9Oh_L3JKkDpB4xR
4
eb54_pZfVti1dPEk8aimw4Hr9ne7VXXVSIQ%3D%3D&expires_in=7200&state=mystate

I hope this helps

Sean Cole
Pi Digital

> On 20 Jul 2018, at 17:11, Keith Clarke via use-livecode <[hidden email]> wrote:
>
> Hi folks,
> I’m trying to access the Salesforce.com <http://salesforce.com/> REST API from LiveCode via their UserAgent flow https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/intro_understanding_user_agent_oauth_flow.htm <https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/intro_understanding_user_agent_oauth_flow.htm>
>
> ...but am struggling with seeding the OAuth2 library to get an authorisation page returned that isn’t blank.
>
> I’m not getting any error messages - just silent failures. I did discover that the redirect_url needed to be secure and so have configured https://localhost <https://localhost/> on my Mac but am now deep in guesswork-land.
>
> The docs are light regarding the OAuth2 library beyond definitions and a single example - and there’s little on the forums. I started a forum thread a few days ago - https://forums.livecode.com/viewtopic.php?f=11&t=31291&p=169196#p169196 <https://forums.livecode.com/viewtopic.php?f=11&t=31291&p=169196#p169196> but I’m guessing this subject is either dead easy (and hence I’m being a numpty!) or very unpopular! :-D
>
> Any clues how I can approach debugging would be greatly appreciated.
> Thanks & regards,
> Keith
>
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: OAuth2 Library troubleshooting

Clarence Martin via use-livecode
Hi Sean,
Thanks for the response - here and in the forum post.

The process is failing at step one before any attempt to return the token, so I think it’s a LiveCode OAuth library/documentation issue - as the parameters that open a blank browser dialogue in LC work fine in Postman’s token request form to get a login page returned.

Time to revisit the web viewer and attempt to roll my own.
Thanks
Keith

> On 20 Jul 2018, at 18:11, Pi Digital via use-livecode <[hidden email]> wrote:
>
> Hi Keith
>
> It is not recommended to use localhost as a redirect. What I tend to do is set up a blank php or jsp on my website and use that as the redirectURL. This url is used to send the token to in a browser request. If the page fails or does not exist then that token is never received. The guide on Salesforce site (the one you linked to) says:
>> Salesforce appends access token information to the redirect URL with the following values:
> And will look like this:
> 1
> https://www.mysite.com/user_callback.jsp#access_token=00Dx0000000BV7z%21AR8
> 2
> AQBM8J_xr9kLqmZIRyQxZgLcM4HVi41aGtW0qW3JCzf5xdTGGGSoVim8FfJkZEqxbjaFbberKGk
> 3
> 8v8AnYrvChG4qJbQo8&refresh_token=5Aep8614iLM.Dq661ePDmPEgaAW9Oh_L3JKkDpB4xR
> 4
> eb54_pZfVti1dPEk8aimw4Hr9ne7VXXVSIQ%3D%3D&expires_in=7200&state=mystate
>
> I hope this helps
>
> Sean Cole
> Pi Digital
>
>> On 20 Jul 2018, at 17:11, Keith Clarke via use-livecode <[hidden email]> wrote:
>>
>> Hi folks,
>> I’m trying to access the Salesforce.com <http://salesforce.com/> REST API from LiveCode via their UserAgent flow https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/intro_understanding_user_agent_oauth_flow.htm <https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/intro_understanding_user_agent_oauth_flow.htm>
>>
>> ...but am struggling with seeding the OAuth2 library to get an authorisation page returned that isn’t blank.
>>
>> I’m not getting any error messages - just silent failures. I did discover that the redirect_url needed to be secure and so have configured https://localhost <https://localhost/> on my Mac but am now deep in guesswork-land.
>>
>> The docs are light regarding the OAuth2 library beyond definitions and a single example - and there’s little on the forums. I started a forum thread a few days ago - https://forums.livecode.com/viewtopic.php?f=11&t=31291&p=169196#p169196 <https://forums.livecode.com/viewtopic.php?f=11&t=31291&p=169196#p169196> but I’m guessing this subject is either dead easy (and hence I’m being a numpty!) or very unpopular! :-D
>>
>> Any clues how I can approach debugging would be greatly appreciated.
>> Thanks & regards,
>> Keith
>>
>>
>> _______________________________________________
>> use-livecode mailing list
>> [hidden email]
>> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode