Click here to Skip to main content
15,886,830 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I downloaded the console application example which uses OAuth 2 to connect to the code projects server and get the titles of the articles and questions. It works and does what it says on the tin. I've got to write an application that connections to the UK HMRC servers to send them information and it uses OAuth 2.

I've got a test user on the HMRC site. I've got my application registered. I've got the client ID, client secret, and the server token. It asks for redirect URIs. This bit I don't get. My Windows application is going to be doing the connecting, sending and collecting responses. How and/or why does it need a redirect URI? The example code from code project to pick up the articles and questions doesn't have a redirect URI. If I register my own application to communicate with the code project APIs it asks for a redirect URI so I can't save the details until I have one and I don't know what to put in there.

What I have tried:

REading docuemtnation and looking at example code
Posted
Updated 19-Feb-19 22:51pm

See User-restricted endpoints - HMRC Developer Hub - GOV.UK[^]
and Reference guide - HMRC Developer Hub - GOV.UK[^]
Quote:
The URI that we use to send users back to your application after successful (or unsuccessful) authorisation.
This must match one of the redirect URIs you specified when you created your application.
GET  https://test-api.service.hmrc.gov.uk/oauth/authorize?response_type=code
&client_id=[YOUR-CLIENT-ID]
&scope=[REQUESTED-SCOPE]
&state=[STATE]
&redirect_uri=[YOUR-REDIRECT-URI]
 
Share this answer
 
v2
I have read that documentation. Taking a step back, if we are talking web technologies, I make a request and the application I am using waits for a response. No different from using a web browser. Click a click, wait for a response. With HMRC, if I am submitting, I submit and await a response. So what is the redirect URI for? I do not understand what it means.

Just so you know, another large project I worked on required me to build a huge web API that sits in IIS and waits for POST and GET request. It has endpoints and a controller sits on the end of each endpoint to process the request. The web API does not ever send data without there first being a request for it.

So, back to HMRC, if I do a GET request to get the obligations, the application is going to wait for a response. I do not see the point of the redirect URI. What is it for? It is suggesting I need to set up a separate web site to redirect things to for some reason.
 
Share this answer
 
Comments
Richard Deeming 20-Feb-19 8:30am    
If you want to reply to a solution, click the "Have a Question or Comment?" button under that solution and post a comment.

DO NOT post your comment in the "Add your solution here" box.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900