OAuth2 Library - how to debug a script?

Bringing the internet highway into your project? Building FTP, HTTP, email, chat or other client solutions?

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Clarkey
Posts: 109
Joined: Fri Jun 11, 2010 11:10 am
Location: UK

OAuth2 Library - how to debug a script?

Post by Clarkey » Tue Jul 17, 2018 3:53 pm

Hi folks,
I'm experimenting with the OAuth2 library and have reached the point where I'm getting an authorisation dialogue from the server without any error messages but it's blank.

I think I may be missing some required parameters but, I haven't used libraries much and can't see how to access the URL being built, so I can validate this against the sample code provided by the service provider.

Any clues greatly appreciated.

Thanks
Keith

seaniepie
Posts: 154
Joined: Wed Sep 07, 2011 10:56 am

Re: OAuth2 Library - how to debug a script?

Post by seaniepie » Fri Jul 20, 2018 6:14 pm

Hi Keith

Following up this discussion from the ‘use’ group, 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:
https://www.mysite.com/user_callback.js ... te=mystate

I hope this helps

Clarkey
Posts: 109
Joined: Fri Jun 11, 2010 11:10 am
Location: UK

Re: OAuth2 Library - how to debug a script?

Post by Clarkey » Fri Jul 20, 2018 7:55 pm

Hi Sean,
Thanks for responding.

I'm using localhost for initial testing as that is stated as required in the docs and I'm trying to stick as close to the example provided. However, as things are failing long before the return of the token, I think that the return URL is a red herring - for now, at least.

My reading of the Salesforce flow is that the first step is for the OAuth library to open a locked down web browser instance into which the Salesforce authorisation page is displayed to capture login details.

This is being opened but it's blank in LC - and the same parameters open the authorisation page fine in Postman's mechanism to get a token.

So, it looks to me like a library issue. I guess I'll have to roll my own mechanism by attempting to wrap a web viewer instance.

Best,
Keith

Post Reply

Return to “Internet”