Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

does Auth::user()->id get set? #77

Closed
thedangler opened this issue Oct 29, 2015 · 3 comments
Closed

does Auth::user()->id get set? #77

thedangler opened this issue Oct 29, 2015 · 3 comments

Comments

@thedangler
Copy link

how would I get the authenticated user id with this API key approach.

I'm trying to make it so that I can use my REST API internally as well as externally.
when using internally the user will be logged in and I'll set the header( I think) unless there is better way to approach this.

@iateadonut
Copy link

like this?

    $headers = apache_request_headers();
    $api_key = $headers['X-Authorization'];

    $user_id = ApiKey::where('key', $api_key)
        ->pluck('user_id');
    Auth::loginUsingId($user_id);

@thedangler
Copy link
Author

Hi, that should work, I can write my own middleware to check for the header or logged in user.
Thank you.

@chrisbjr
Copy link
Owner

Closing this issue

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

No branches or pull requests

3 participants