Skip to content
This repository was archived by the owner on Jul 22, 2024. It is now read-only.

PHP error in callback.php #5

Open
swbuehler opened this issue Dec 2, 2014 · 3 comments
Open

PHP error in callback.php #5

swbuehler opened this issue Dec 2, 2014 · 3 comments

Comments

@swbuehler
Copy link

When trying to use the PDF posting button, the post fails, and the PHP log shows the following:

[02-Dec-2014 12:52:54 America/New_York] PHP Notice:  Undefined index: code in C:\inetpub\wwwroot\OneNote\callback.php on line 140
[02-Dec-2014 12:52:54 America/New_York] PHP Notice:  Undefined index: error in C:\inetpub\wwwroot\OneNote\callback.php on line 176
[02-Dec-2014 12:52:54 America/New_York] PHP Notice:  Undefined index: error_description in C:\inetpub\wwwroot\OneNote\callback.php on line 177

I logged out from Live and back in, and tried the post again, this time getting the following PHP error:

[02-Dec-2014 12:56:40 America/New_York] PHP Notice:  Use of undefined constant SERVER_NAME - assumed 'SERVER_NAME' in C:\inetpub\wwwroot\OneNote\callback.php on line 222

I'm using PHP 5.6.0 on an IIS 8.5 install.

@gakselrod
Copy link

Hi swbuehler-

For the first set of log lines, this implies that something went wrong when trying to auth with the auth server. Are you able to reproduce this error? Can you tell us the full URL you're redirected to (callback.php?...) ? Sometimes there's useful information in the query string. The easiest way to see what's going on is by watching the requests with Fiddler.

Some easy things to double check: make sure you've set all the config variables per the instructions under the Set up the sample in the readme -- for both callback.php and index.php.

Also note that you must have cURL installed for this code sample to work.

For the second notice you posted -- this notice can be safely ignored -- it's not an error, only a warning. To make it go away, change line 222 from:

setrawcookie(AUTHCOOKIE, buildQueryString($cookieValues), 0, '/', $_SERVER[SERVER_NAME]);

to (notice the quotes around SERVER_NAME)

setrawcookie(AUTHCOOKIE, buildQueryString($cookieValues), 0, '/', $_SERVER["SERVER_NAME"]);

@swbuehler
Copy link
Author

I got authentication to work, and got this back:


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"

        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"

      xmlns:msgr="http://messenger.live.com/2009/ui-tags">

<head>

    <title>Live SDK Callback Page</title>

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

</head>

<body>

</body>

</html>

When I did one of the submit buttons, I got back:


<html><head><title>OneNote Service API Result</title></head><body><h1>OneNote Service API Result</h1><h2>Something went wrong...</h2></b></h2><h3>Response</h3><pre></pre><br /><a href="index.php">&lt;- Go back</a></body></html>

Nothing.

Looks like sign-in worked, but submitting the page gave me back nothing.

From: CompMan86 [mailto:[email protected]]
Sent: Wednesday, December 3, 2014 7:16 PM
To: OneNoteDev/OneNoteAPISamplePHP
Cc: Steven Buehler
Subject: Re: [OneNoteAPISamplePHP] PHP error in callback.php (#5)

Hi swbuehler-

For the first set of log lines, this implies that something went wrong when trying to auth with the auth server. Are you able to reproduce this error? Can you tell us the full URL you're redirected to (callback.php?...) ? Sometimes there's useful information in the query string. The easiest way to see what's going on is by watching the requests with Fiddler.

Some easy things to double check: make sure you've set all the config variables per the instructions under the Set up the sample https://github.com/OneNoteDev/OneNoteAPISamplePHP#set-up-the-sample in the readme -- for both callback.php and index.php.

Also note that you must have cURL installed for this code sample to work.

For the second notice you posted -- this notice can be safely ignored -- it's not an error, only a warning. To make it go away, change line 222 from:

setrawcookie(AUTHCOOKIE, buildQueryString($cookieValues), 0, '/', $_SERVER[SERVER_NAME]);

to (notice the quotes around SERVER_NAME)

setrawcookie(AUTHCOOKIE, buildQueryString($cookieValues), 0, '/', $_SERVER["SERVER_NAME"]);


Reply to this email directly or view it on GitHub #5 (comment) . https://github.com/notifications/beacon/AATQqKqyevADXDxFLQ_CEl3UG5CibieHks5nT58ugaJpZM4DDHJo.gif

@machandw-microsoft
Copy link
Contributor

Hi Steven,

Can you check the title of the page where you see “Something went wrong”.

I suspect the authentication request did not succeed, based on what you are seeing.

If so, the title of the page will contain more details. A common reason is that the redirect URL in the application’s registration page does not match the URL to reach the callback module on the server on which your application is hosted.

Thanks,
Manoj

From: Steven Buehler [mailto:[email protected]]
Sent: Thursday, December 4, 2014 4:59 PM
To: OneNoteDev/OneNoteAPISamplePHP
Subject: Re: [OneNoteAPISamplePHP] PHP error in callback.php (#5)

I got authentication to work, and got this back:


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"

"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"

xmlns:msgr="http://messenger.live.com/2009/ui-tags">

<head>

<title>Live SDK Callback Page</title>

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

</head>

<body>

</body>

</html>

When I did one of the submit buttons, I got back:


<html><head><title>OneNote Service API Result</title></head><body><h1>OneNote Service API Result</h1><h2>Something went wrong...</h2></b></h2><h3>Response</h3><pre></pre><br /><a href="index.php">&lt;- Go back</a></body></html>

Nothing.

Looks like sign-in worked, but submitting the page gave me back nothing.

From: CompMan86 [mailto:[email protected]]
Sent: Wednesday, December 3, 2014 7:16 PM
To: OneNoteDev/OneNoteAPISamplePHP
Cc: Steven Buehler
Subject: Re: [OneNoteAPISamplePHP] PHP error in callback.php (#5)

Hi swbuehler-

For the first set of log lines, this implies that something went wrong when trying to auth with the auth server. Are you able to reproduce this error? Can you tell us the full URL you're redirected to (callback.php?...) ? Sometimes there's useful information in the query string. The easiest way to see what's going on is by watching the requests with Fiddler.

Some easy things to double check: make sure you've set all the config variables per the instructions under the Set up the sample https://github.com/OneNoteDev/OneNoteAPISamplePHP#set-up-the-sample in the readme -- for both callback.php and index.php.

Also note that you must have cURL installed for this code sample to work.

For the second notice you posted -- this notice can be safely ignored -- it's not an error, only a warning. To make it go away, change line 222 from:

setrawcookie(AUTHCOOKIE, buildQueryString($cookieValues), 0, '/', $_SERVER[SERVER_NAME]);

to (notice the quotes around SERVER_NAME)

setrawcookie(AUTHCOOKIE, buildQueryString($cookieValues), 0, '/', $_SERVER["SERVER_NAME"]);


Reply to this email directly or view it on GitHub #5 (comment) . https://github.com/notifications/beacon/AATQqKqyevADXDxFLQ_CEl3UG5CibieHks5nT58ugaJpZM4DDHJo.gif


Reply to this email directly or view it on GitHubhttps://github.com//issues/5#issuecomment-65731845.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants