[GH-ISSUE #432] http://localhost:8000/api/me 401 (Unauthorized) #305

Closed
opened 2026-02-26 02:32:45 +03:00 by kerem · 16 comments
Owner

Originally created by @hiennc24 on GitHub (Sep 1, 2016).
Original GitHub issue: https://github.com/koel/koel/issues/432

Hey Phannan

When I created admin account:

Please help fix bug this. Thank you so much.

Originally created by @hiennc24 on GitHub (Sep 1, 2016). Original GitHub issue: https://github.com/koel/koel/issues/432 Hey Phannan When I created admin account: - email: hiennguyen.it1990@gmail.com - password: 123456 and I run : php artisan koel:init After I login using account this, it's show bug : "http://localhost:8000/api/me 401 (Unauthorized)". Please help fix bug this. Thank you so much.
kerem closed this issue 2026-02-26 02:32:45 +03:00
Author
Owner

@BernardGoldberger commented on GitHub (Sep 5, 2016):

@Nguyenchathien Are you saying you were able to login? where exactly do you get the error?

<!-- gh-comment-id:244732351 --> @BernardGoldberger commented on GitHub (Sep 5, 2016): @Nguyenchathien Are you saying you were able to login? where exactly do you get the error?
Author
Owner

@hiennc24 commented on GitHub (Sep 7, 2016):

@bdgold I open console on chrome browser

<!-- gh-comment-id:245171002 --> @hiennc24 commented on GitHub (Sep 7, 2016): @bdgold I open console on chrome browser
Author
Owner

@BernardGoldberger commented on GitHub (Sep 7, 2016):

@Nguyenchathien you are getting the error because its wrong username or password.

You will have to tack it down to see where it went wrong, my guess would be its in the env, maybe an extra character or even a space in the password.

Remember, you can check the users table to verify the username, you can also use php artisan tinker to do a Hash::check('123456', 'here paste the password hash') and it should tell you true or false.

<!-- gh-comment-id:245274987 --> @BernardGoldberger commented on GitHub (Sep 7, 2016): @Nguyenchathien you are getting the error because its wrong username or password. You will have to tack it down to see where it went wrong, my guess would be its in the env, maybe an extra character or even a space in the password. Remember, you can check the users table to verify the username, you can also use `php artisan tinker` to do a `Hash::check('123456', 'here paste the password hash')` and it should tell you `true` or `false`.
Author
Owner

@hiennc24 commented on GitHub (Sep 8, 2016):

@bdgold I have fixed this. Thank you so much

<!-- gh-comment-id:245474124 --> @hiennc24 commented on GitHub (Sep 8, 2016): @bdgold I have fixed this. Thank you so much
Author
Owner

@fuzzymannerz commented on GitHub (Sep 8, 2016):

I'm currently having the same issue. The password and login e-mail are correct, I have dropped the entire table and created it again and the same thing happens.
I will try to figure it out and report back.

<!-- gh-comment-id:245658831 --> @fuzzymannerz commented on GitHub (Sep 8, 2016): I'm currently having the same issue. The password and login e-mail are correct, I have dropped the entire table and created it again and the same thing happens. I will try to figure it out and report back.
Author
Owner

@pabsroq commented on GitHub (Sep 9, 2016):

@Nguyenchathien how did you fix it?

<!-- gh-comment-id:245825878 --> @pabsroq commented on GitHub (Sep 9, 2016): @Nguyenchathien how did you fix it?
Author
Owner

@morph1904 commented on GitHub (Sep 9, 2016):

Hi I have just had the same issue and it seems the php artisan koel:init command is not hashing the password in the db and is storing it plain text.

when i try to login using the password it does not let me in. i have tried hashing the password and updating the DB but this does not work.

I updated the password in the DB with the hashed version the ensured that the ctype php extension was installed and that corrected my issue

<!-- gh-comment-id:245921451 --> @morph1904 commented on GitHub (Sep 9, 2016): Hi I have just had the same issue and it seems the php artisan koel:init command is not hashing the password in the db and is storing it plain text. when i try to login using the password it does not let me in. i have tried hashing the password and updating the DB but this does not work. I updated the password in the DB with the hashed version the ensured that the ctype php extension was installed and that corrected my issue
Author
Owner

@BernardGoldberger commented on GitHub (Sep 9, 2016):

Can we have the full console output for koel:init.

<!-- gh-comment-id:245926665 --> @BernardGoldberger commented on GitHub (Sep 9, 2016): Can we have the full console output for `koel:init`.
Author
Owner

@morph1904 commented on GitHub (Sep 9, 2016):

`lee$ php artisan koel:init
Attempting to install or upgrade Koel.
Remember, you can always install/upgrade manually following the guide here:
📙  https://github.com/phanan/koel/wiki

App key exists -- skipping
JWT secret exists -- skipping
Migrating database
Seeding initial data
Executing npm install, gulp and whatnot

> koel@ postinstall /Users/lee/Documents/Websites/ByteSenseMusic
> cross-env NODE_ENV=production && gulp --production

[14:45:50] Using gulpfile ~/Documents/Websites/ByteSenseMusic/gulpfile.js
[14:45:50] Starting 'default'...
[14:45:50] Starting 'browserify'...

Fetching Browserify Source Files...
   - resources/assets/js/main.js


Saving To...
   - public/js/main.js

[14:46:01] Finished 'default' after 10 s
[14:46:27] gulp-notify: [Laravel Elixir] Browserify Compiled!
[14:46:28] Finished 'browserify' after 37 s
[14:46:28] Starting 'sass'...

Fetching Sass Source Files...
   - resources/assets/sass/app.scss


Saving To...
   - public/css/app.css

[14:46:47] gulp-notify: [Laravel Elixir] Sass Compiled!
[14:46:47] Finished 'sass' after 20 s
[14:46:47] Starting 'copy'...

Fetching Copy Source Files...
   - resources/assets/img/**/*


Saving To...
   - public/img

[14:46:47] Finished 'copy' after 197 ms
[14:46:47] Starting 'copy'...

Fetching Copy Source Files...
   - node_modules/font-awesome/fonts/**/*


Saving To...
   - public/build/fonts

[14:46:48] Finished 'copy' after 306 ms
[14:46:48] Starting 'copy'...

Fetching Copy Source Files...
   - resources/assets/fonts/**/*


Saving To...
   - public/build/fonts

[14:46:48] Finished 'copy' after 158 ms
[14:46:48] Starting 'scripts'...

Fetching Scripts Source Files...
   - node_modules/babel-polyfill/dist/polyfill.min.js
   - node_modules/plyr/dist/plyr.js
   - node_modules/rangetouch/dist/rangetouch.js
   - resources/assets/js/libs/modernizr-custom.js


Saving To...
   - public/js/vendors.js

[14:46:52] gulp-notify: [Laravel Elixir] Scripts Merged!
[14:46:52] Finished 'scripts' after 3.69 s
[14:46:52] Starting 'styles'...

Fetching Styles Source Files...
   - resources/assets/css/**/*.css
   - node_modules/font-awesome/css/font-awesome.min.css
   - node_modules/rangeslider.js/dist/rangeslider.css
   - node_modules/sweetalert/dist/sweetalert.css


Saving To...
   - public/css/vendors.css

[14:46:53] gulp-notify: [Laravel Elixir] Stylesheets Merged!
[14:46:53] Finished 'styles' after 1.69 s
[14:46:53] Starting 'version'...

Fetching Version Source Files...
   - public/css/vendors.css
   - public/css/app.css
   - public/js/vendors.js
   - public/js/main.js


Saving To...
   - public/build

[14:46:54] Finished 'version' after 255 ms
[14:46:54] Starting 'browserSync'...
[14:46:54] Finished 'browserSync' after 115 μs

🎆  Success! You can now run Koel from localhost with `php artisan serve`.
Again, for more configuration guidance, refer to
📙  https://github.com/phanan/koel/wiki.
WIKI ROCKS WIKI RULES.
KTHXBYE.
<!-- gh-comment-id:245927409 --> @morph1904 commented on GitHub (Sep 9, 2016): ``` `lee$ php artisan koel:init Attempting to install or upgrade Koel. Remember, you can always install/upgrade manually following the guide here: 📙 https://github.com/phanan/koel/wiki App key exists -- skipping JWT secret exists -- skipping Migrating database Seeding initial data Executing npm install, gulp and whatnot > koel@ postinstall /Users/lee/Documents/Websites/ByteSenseMusic > cross-env NODE_ENV=production && gulp --production [14:45:50] Using gulpfile ~/Documents/Websites/ByteSenseMusic/gulpfile.js [14:45:50] Starting 'default'... [14:45:50] Starting 'browserify'... Fetching Browserify Source Files... - resources/assets/js/main.js Saving To... - public/js/main.js [14:46:01] Finished 'default' after 10 s [14:46:27] gulp-notify: [Laravel Elixir] Browserify Compiled! [14:46:28] Finished 'browserify' after 37 s [14:46:28] Starting 'sass'... Fetching Sass Source Files... - resources/assets/sass/app.scss Saving To... - public/css/app.css [14:46:47] gulp-notify: [Laravel Elixir] Sass Compiled! [14:46:47] Finished 'sass' after 20 s [14:46:47] Starting 'copy'... Fetching Copy Source Files... - resources/assets/img/**/* Saving To... - public/img [14:46:47] Finished 'copy' after 197 ms [14:46:47] Starting 'copy'... Fetching Copy Source Files... - node_modules/font-awesome/fonts/**/* Saving To... - public/build/fonts [14:46:48] Finished 'copy' after 306 ms [14:46:48] Starting 'copy'... Fetching Copy Source Files... - resources/assets/fonts/**/* Saving To... - public/build/fonts [14:46:48] Finished 'copy' after 158 ms [14:46:48] Starting 'scripts'... Fetching Scripts Source Files... - node_modules/babel-polyfill/dist/polyfill.min.js - node_modules/plyr/dist/plyr.js - node_modules/rangetouch/dist/rangetouch.js - resources/assets/js/libs/modernizr-custom.js Saving To... - public/js/vendors.js [14:46:52] gulp-notify: [Laravel Elixir] Scripts Merged! [14:46:52] Finished 'scripts' after 3.69 s [14:46:52] Starting 'styles'... Fetching Styles Source Files... - resources/assets/css/**/*.css - node_modules/font-awesome/css/font-awesome.min.css - node_modules/rangeslider.js/dist/rangeslider.css - node_modules/sweetalert/dist/sweetalert.css Saving To... - public/css/vendors.css [14:46:53] gulp-notify: [Laravel Elixir] Stylesheets Merged! [14:46:53] Finished 'styles' after 1.69 s [14:46:53] Starting 'version'... Fetching Version Source Files... - public/css/vendors.css - public/css/app.css - public/js/vendors.js - public/js/main.js Saving To... - public/build [14:46:54] Finished 'version' after 255 ms [14:46:54] Starting 'browserSync'... [14:46:54] Finished 'browserSync' after 115 μs 🎆 Success! You can now run Koel from localhost with `php artisan serve`. Again, for more configuration guidance, refer to 📙 https://github.com/phanan/koel/wiki. WIKI ROCKS WIKI RULES. KTHXBYE. ```
Author
Owner

@fuzzymannerz commented on GitHub (Sep 9, 2016):

I have the same output with the addition of:

npm WARN optional Skipping failed optional dependency /chokidar/fsevents:
npm WARN notsup Not compatible with your operating system or architecture: fsevents@1.0.14

The password in the DB is not hashed either.

<!-- gh-comment-id:245939479 --> @fuzzymannerz commented on GitHub (Sep 9, 2016): I have the same output with the addition of: ``` npm WARN optional Skipping failed optional dependency /chokidar/fsevents: npm WARN notsup Not compatible with your operating system or architecture: fsevents@1.0.14 ``` The password in the DB is not hashed either.
Author
Owner

@fuzzymannerz commented on GitHub (Sep 9, 2016):

As a workaround I created the password hash by running php artisan tinker then echo Hash::make('passwordhere'); and copying the password into the database. It now works.

<!-- gh-comment-id:245943981 --> @fuzzymannerz commented on GitHub (Sep 9, 2016): As a workaround I created the password hash by running `php artisan tinker` then `echo Hash::make('passwordhere');` and copying the password into the database. It now works.
Author
Owner

@morph1904 commented on GitHub (Sep 9, 2016):

That's the same as what I did.

<!-- gh-comment-id:245946523 --> @morph1904 commented on GitHub (Sep 9, 2016): That's the same as what I did.
Author
Owner

@BernardGoldberger commented on GitHub (Sep 9, 2016):

What version of koel are you guys running?

<!-- gh-comment-id:245950444 --> @BernardGoldberger commented on GitHub (Sep 9, 2016): What version of koel are you guys running?
Author
Owner

@fuzzymannerz commented on GitHub (Sep 9, 2016):

I'm running the current release - 3.3.0

<!-- gh-comment-id:245951857 --> @fuzzymannerz commented on GitHub (Sep 9, 2016): I'm running the current release - 3.3.0
Author
Owner

@morph1904 commented on GitHub (Sep 9, 2016):

Same here. Downloaded today.

<!-- gh-comment-id:245952525 --> @morph1904 commented on GitHub (Sep 9, 2016): Same here. Downloaded today.
Author
Owner

@BernardGoldberger commented on GitHub (Sep 9, 2016):

Ok, I believe I introduced the issue with https://github.com/phanan/koel/pull/420/commits/47ae18b5349155089151902c3b516ee21447e4a3.

To verify, can you please do git checkout v3.3.0 and then try again.

<!-- gh-comment-id:245981340 --> @BernardGoldberger commented on GitHub (Sep 9, 2016): Ok, I believe I introduced the issue with https://github.com/phanan/koel/pull/420/commits/47ae18b5349155089151902c3b516ee21447e4a3. To verify, can you please do `git checkout v3.3.0` and then try again.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/koel-koel#305
No description provided.