Getting error while redirecting to login page in Oauth-Advance sample.

Not applicable

I downloaded the Oauth-Advanced sample from the github. Uploaded the proxies. Followed the steps given in git hub. In developer App the callback url is ushasree-test-apigee.net/web/callback

When I access the http://ushasree-test.apigee.net/web i got page with button “Login with Apigee Example Auth”.After clicking on the button I am getting error.

<strong>“{"fault":{"faultstring":"Execution of BuildLoginPageUrl failed with error: Exception thrown from JavaScript : Invalid Request: Invalid Redirect URI. (build_login_url_js#32)","detail":{"errorcode":"steps.javascript.ScriptExecutionFailed"}}}”</strong>
Url redirected after clicking button is:
<a href="https://ushasree-test.apigee.net/oauth2/authorize?client_id=IF6Zi5yOhKWANUNpNUOr9WcgVdPxAdBr&redirect_uri=https://ushasree-test.apigee.net/web/callback&response_type=code&scope=order&state=123">https://ushasree-test.apigee.net//oauth2/authorize?client_id=IF6Zi5yOhKWANUNpNUOr9WcgVdPxAdBr&redirect_uri=https://ushasree-test.apigee.net/web/callback&response_type=code&scope=order&state=123</a>
0 4 1,061
4 REPLIES 4

Not applicable

Possible causes:

1. Can you check "response_type=code≻ope=order" why is there a '>' symbol instead of an `&`

2. If you look at the comment in the JS (build_url_js) file

//if redirect_uri from request does not match what is registered for the app, throw a fault

ensure you redirect_uri matches exact value of Callback URL in the developer app. If you can - do not give the redirect_uri in your request. It should work.

1. '>' symbol int he respose-type is just a type mistake when posting the question.

https://ushasree-test.apigee.net//oauth2/authorize?client_id=IF6Zi5yOhKWANUNpNUOr9WcgVdPxAdBr&redire...

2.ushasree-test.apigee.net/web/callback is the callbaclURL i am giving in the developer app. it is same as the redirect_uri=https://ushasree-test.apigee.net/web/callback which is coming the URL , But still i am getting the error.

{"fault":{"faultstring":"Execution of BuildLoginPageUrl failed with error: Exception thrown from JavaScript : Invalid Request: Invalid Redirect URI. (build_login_url_js#32)","detail":{"errorcode":"steps.javascript.ScriptExecutionFailed"}}}

Is the API part of the API Product that the Developer App has access to. The App corresponding to the client id:

IF6Zi5yOhKWANUNpNUOr9WcgVdPxAdBr

should have that API proxy as part of it.

Hi UshaSree,

It's unclear from your comments that the redirect_uri in your API call and the Callback URI in the developer app match. They have to match exactly. So, if the Callback URI is

"ushasree-test.apigee.net/web/callback"

then the redirect_uri can't be:

"https://ushasree-test.apigee.net/web/callback".

It's possible these are only typos in copying into this post, but if not, that could be the problem and will cause the error if you specify a redirect_uri, as sriki77 noted.