The given value for the input parameter 'redirect_uri' is invalid

I keep getting this error from Windows Live

The provided value for the input parameter 'redirect_uri' is not valid. The expected value is 'https://login.live.com/oauth20_desktop.srf' or the URL that matches the redirect

Why do I keep getting this error. I have a domain installed in an application for a live Windows developer

in the <head> element I

<script src="//js.live.net/v5.0/wl.js"></script> 

just below the <body> element I

  WL.init({ client_id: '{S_AL_WL_CLIENT_ID}', //{S_AL_WL_CLIENT_ID} = phpbb template variable for client_id redirect_uri: '{AL_BOARD_URL}', //{AL_BOARD_URL} = phpbb template variable for the urlencoded domain name response_type: 'token', scope: ["wl.signin", "wl.basic", "wl.birthday", "wl.emails", "wl.work_profile", "wl.postal_addresses"] }); 

login button

  <div id="login"> <a href="#"><img src="images/windows_live_connect.png" alt="Windows Live" /></a> </div> 

listener

 jQuery('#login a').click(function(e) { e.preventDefault(); WL.login({ scope: ["wl.signin", "wl.basic", "wl.birthday", "wl.emails", "wl.work_profile", "wl.postal_addresses"] }).then(function (response) { //do something with stuff here. You know brainy type ajaxy stuff to auth a user }, function (responseFailed) { console.log("Error signing in: " + responseFailed.error_description); }); }); 
+4
source share
1 answer

The problem turned out to be that redirect_uri should be exactly http://www.yourdomain.com , not http://yourdomain.com . Therefore, if the user enters http://yourdomain.com , then this error will be displayed, but if the user has http://www.yourdomain.com , then the script works.

I think I am very spoiled by Facebook Api.

So in the end, I just made a regex to match any URL using the login button and made it be www with .htaccess.

+4
source

Source: https://habr.com/ru/post/1436581/


All Articles