function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Mike WaughMike Waugh 

REST Callout not following the redirect

I am trying to make my app call out to our webserver to synchronize some data but I keep getting "<html><body>You are being <a href="">redirected</a>.</body></html>" as a response and the request ends.


How do I get the http request to follow through to the endpoint?


My code is as follows:


    Blob toEncode = Blob.valueof( key + ':' + UserInfo.getUserName());

    System.debug( 'Encoded Auth: ' + Encodingutil.base64Encode(toEncode));


    Http h = new Http();


    HttpRequest req = new HttpRequest();


    req.setHeader('Authorization', 'Basic ' + Encodingutil.base64Encode(toEncode));



   HttpResponse response = h.send(req);


   System.debug( response.getBody() ); => <html><body>You are being <a href="">redirected</a>.</body></html>







I have got similar kind of response like

"_____response_______________________________The URL has moved <a href="">here</a>"

, when I made a request to

url = ''+consmer_key+'&redirect_uri='+redrct_uri+'&scope=full';

In this case just bring that resonce to the Visualforce page .

Now yo will see it like

You are being redirected (here redirected is a hyperlink) , when you will clik on this you will redirected to the another required page , as of when I used this hyperlink I was redirected to a authorisation page.

In my case I was redicected to RemoteAccessAuthorizationPage .


Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved.