Skip to content

Stateless#68

Merged
taylorotwell merged 5 commits intolaravel:2.0from
isaackearl:stateless
May 11, 2015
Merged

Stateless#68
taylorotwell merged 5 commits intolaravel:2.0from
isaackearl:stateless

Conversation

@isaackearl
Copy link
Copy Markdown
Contributor

I'm working on a project that is an API, which utilizes JWT tokens, and is stateless.

Having a stateless option would very nice so that I can use socialite without utilizing the session. I've made some modifications to have it check if the stateless flag has been set. By default it acts exactly as it did before so this change will not affect any current users.

it can be used like this for the redirect:

return Socialize::with($provider)->stateless()->redirect();

and like this for the user:

$provider_user = Socialize::with($provider)->stateless()->user();

of course it can still be used in conjuction with scopes etc

 return Socialize::with($provider)
                ->stateless()
                ->scopes(['email'])
                ->redirect();

The main use case is if somebody is doing the redirect (authorization) portion using a frontend client like angular etc. Then they want to be able to make a request to the backend and get the user... so in that case the redirect() function would never be used and a stateless option is needed for the user() function.

If you don't like it please let me know if there is another approach I could take that might get accepted.

.gitignore Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no

@isaackearl
Copy link
Copy Markdown
Contributor Author

Let me know if there is anything else I could improve upon, or if there is another approach you want me to take to solve this problem.

@GrahamCampbell
Copy link
Copy Markdown
Contributor

This should probably go to 3.0, not 2.0.

@isaackearl
Copy link
Copy Markdown
Contributor Author

Hey Graham, Sorry for being a noob but I'm hoping you can give me a bit of direction. After pulling in the master branch, it seems as though the 2.0 version is actually ahead of the 3.0 version by a few commits. I was going to close this pull request and add something similar to 3.0, but I think it would cause some merging conflicts when it comes time to merge. Shall I leave this here for now? Thanks.

@taylorotwell taylorotwell merged commit d44432c into laravel:2.0 May 11, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants