Comments (20)
You need to use namespace, i.e. Milo\Github\OAuth\Login
.
from github-api.
Ah ok works :) Thank you!
I now get something like this on var_dump:
And when i simple return the token, I don`t get any output.
How can I get the token out of this?
from github-api.
You need to load github-api.php
(or setup autoloading) before calling session_start
.
from github-api.
Yep I`m doing that, otherwise I would not get this response I guess.
from github-api.
No, __PHP_Incomplete_Class
means that at the time of session_start
the class Milo\Github\OAuth\Token
is undefined.
from github-api.
This is my code
Without the github-api.php
I would not be able to use Milo\Github\OAuth\
and these stuff, right?
from github-api.
Strange. Do you have error_reporting set to E_ALL and enabled display_errors?
from github-api.
@TheZoker Try to dump the $_SESSION
content. Isn't there some garbage? If so, clean it somehow.
The library uses $_SESSION['milo.github-api']
. Isn't touched by another app?
from github-api.
This is the dump of $_SESSION
I use it to build a wordpress plugin, so it should be untouched
from github-api.
Try unset($_SESSION['milo.github-api'])
directly after the session_start()
. Only once and remove it. Then, try whole auth roundtrip again.
from github-api.
Oh, maybe I got it. Isn't session started somewhere earlier? I mean, your session_start()
in oauth() function is the second call.
from github-api.
But I dont have any other session_start()
anywhere else
from github-api.
Wordpress does not start it? Or maybe PHP's session.auto_start
? Try var_dump(session_status());
before the require_once ...;
from github-api.
So there is another plugin uses the session
Btw: How can I open the oauth window in a new window (popup)?
from github-api.
I see. So, session is somewhere already started before you load the github-api libs. I don't know the Wordpress, maybe there is some hook for plugins to load the libraries first.
If not, you can try this nasty hack in here and let me know.
public function getToken()
{
$token = $this->storage->get('auth.token');
if ($token === NULL) {
throw new Github\LogicException('Token has not been obtained yet.');
} elseif ($token instanceof \__PHP_Incomplete_Class) {
$token = unserialize(serialize($token));
}
return $token;
}
from github-api.
Btw: How can I open the oauth window in a new window (popup)?
Sorry, that's the frontend thing which I don't solve.
from github-api.
I can`t test it, because I get this error:
https://github.com/TheZoker/GithubTemp/blob/master/helper.php#L16
https://github.com/TheZoker/GithubTemp/blob/master/ajax.php
https://github.com/TheZoker/GithubTemp/blob/master/assets/script.js
Thank you very much for your help!
from github-api.
@TheZoker The error is caused by the Same Origin Policy setting. It is not relevant to this library.
Anyway, I released a new version 1.4.3 where is a token in session stored as an ordinary array. It prevents __PHP_Incomplete_Class
error.
from github-api.
@milo Is there any way to generate and save a state without calling askPermissions() ?
from github-api.
No, if you need a user's permissions. Btw. why do you access GitHub webpage by AJAX? You need to redirect a browser window. User will click 'Accept' on GitHub web and than will be redirected back to your site.
from github-api.
Related Issues (20)
- Is PHP dependency ">=5.4.0" mandatory? HOT 2
- Api::decode() fails when parsing result of Request::HEAD request HOT 5
- SSL: invalid CA certificate #1 (offset 0) in bundle HOT 4
- Undefined property: stdClass::$errors HOT 2
- Personal Access Tokens HOT 2
- oAuth fails at second time HOT 2
- watchers count wrong? HOT 8
- PSR4 compliant
- param replacement no separated by '/' error HOT 2
- Heads up: Stricter validation coming soon on the add/update org membership API endpoint HOT 2
- Watchers wrong, how to get real? HOT 1
- Suggestion: Include `subscribers_count` in repository list at `/users/:user/repos`. HOT 1
- facebook.com/jeanne.garneski
- <>
- Getting error "'SSL certificate problem: unable to get local issuer certificate'" HOT 2
- Headers/body are not getting separated properly HOT 17
- Feature request: dummy aggresive caching HOT 4
- Support for full URLs in get(), post() etc. - desired feature? HOT 6
- Error processing 422 response codes HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from github-api.