OAuth2 Revisited


I cannot use a TWebRestClient to get a token from the HMRC site because of CORS so I have to find another way of doing this. The following opens the page correctly:

   window.open(URL, 'oauth', 'width=800, height=600, location=no, toolbar=no, menubar=no,
     titlebar=no. location=no');

When the user has authorised our usage HMRC will do GET http://localhost:8000/Bridge/Bridge.html?code=hujuhkjhksdhkhs

How can I get this code?



You can make call a function from a window opener, so you'd need to find if you can call the opener from this GET handler:
See also:


We used a similar technique for enabling OAUTH2 (see Google Calendar sample) in a TMS WEB Core application where the OAUTH authentication window calls a function in the opener window to communicate the access token.

Thanks Bruno.

I can't actually believe that I managed to get this to work! Thanks again :)