rluders / wn-jwtauth-plugin

JWTAuth Plugin for WinterCMS
GNU General Public License v3.0
29 stars 28 forks source link

How to refresh token ? #54

Closed Incremental92 closed 3 years ago

Incremental92 commented 3 years ago

Ahoj Ricardo, I'm trying to refresh the token in Vue.js with the following script refreshToken ({ commit }) { const authorization = { headers: { 'Authorization': 'Bearer ' + state.token } } this.$axios .patch(SERVER_URL + "/api/auth/refresh-token", authorization) .then(response => { } I get first an HTTP 200, then an HTTP 404 and finally a CORS error "Network Error"

Could it be the same as issue https://github.com/rluders/oc-jwtauth-plugin/issues/49 ?

image

rluders commented 3 years ago

You are getting these errors 'cause of the CORS issue. I'll work on a solution this weekend. :)

rluders commented 3 years ago

It should be fixed once you update the CORS plugin.

Incremental92 commented 3 years ago

Ricardo, the version in OctoberCMS stick to 1.0.3 I can't update to 1.0.5 ! Should it be done manually ?

rluders commented 3 years ago

Oh. It is probably cause I decided to make the version that is installed from the Marketplace to be paid.

So, if you want to keep using it from the marketplace, you need to buy it. It is the way that I found to help me keep working on it, and also helping the OctoberCMS to get part of the money. Benefits from buying is that you get the easy install and auto update functionality.

Otherwise, you can install it directly from the github if you want. 'Cause it still free if you install direct from the repository, not using the OctoberCMS Marketplace.

Incremental92 commented 3 years ago

Yes, but I mean the CORS plugin. It is still free ?

rluders commented 3 years ago

Ops, sorry. I'm almost sleeping here.

Yes. It still free to be installed by the marketplace. It didn't get updated there yet? Maybe I need to trigger something manually to release the new version.

On Sat, Jan 23, 2021, 23:52 Incremental92 notifications@github.com wrote:

Yes, but I mean the CORS plugin. It still free ?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/rluders/oc-jwtauth-plugin/issues/54#issuecomment-766194845, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABOUM76M24MHMKMSUMN3J3S3NHK3ANCNFSM4WGPHQWA .

rluders commented 3 years ago

Yeah. It seems that the Marketplace didn't automatically trigger the version release. So, I did it manually, you should be able to update it from the CMS administration right now.

Incremental92 commented 3 years ago

Hello Ricardo, I updated succesfully the CORS now, but I'm not able to login now. I get the following error from October : image

rluders commented 3 years ago

Looks like it didn't downloaded the dependencies for some reason. Can I recommend you to uninstall the plug-in and install it again?

Incremental92 commented 3 years ago

I uninstalled CORS and reinstalled, but I get the same error.

rluders commented 3 years ago

Okay . Let me check it.

On Sun, Jan 24, 2021, 12:54 Incremental92 notifications@github.com wrote:

I uninstalled CORS and reinstalled, but I get the same error.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/rluders/oc-jwtauth-plugin/issues/54#issuecomment-766335479, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABOUMZKPZGKJLBWPI7RIOTS3QC6LANCNFSM4WGPHQWA .

rluders commented 3 years ago

@Incremental92 it seems that the OctoberCMS isn't installing the dependencies. Which method did you use to install the OctoberCMS? Composer?

Incremental92 commented 3 years ago

Well, I'm developping on W10 with WinNMP and I installed October with the official installer : install-master.zip

rluders commented 3 years ago

Not sure what is causing it. But there is a working around that you can do.

Note: I do recommend you make a FULL PROJECT BACKUP before executing the following steps. :)

  1. Download this composer.json file
  2. Copy the file to the plugin folder: <myoctobercms>/plugins/rluders/cors
  3. Then download this composer.json file
  4. Copy the file to the OctoberCMS root folder.
  5. Edit your <myoctobercms>/config/cms.php and change the disableCoreUpdates to true.
  6. Open a terminal from your OctoberCMS root folder and execute the command: composer update

It should install the plugin dependencies. I'm not sure why it is not installing it by default, I'm wondering if it is not a bug related to the OctoberCMS.

Incremental92 commented 3 years ago

Thanks, I will try. But I don't really understand the problem. Is it a declaration not resolved in your plugin and do you think there's a workaround to do in your plugin ? Otherwise could a bug be opened on the October project ?

rluders commented 3 years ago

I'm not sure. I thibk that it could be a isos at the OctoberCMS, but I need to check.

Probably by installing any other plug-in that depends on composer to manage its dependencies will give some idea about what is happening.

But today I'm done. Maybe tomorrow I'll have some time to work on it.

Incremental92 commented 3 years ago

I got these errors : Loading composer repositories with package information Warning from https://repo.packagist.org: You are using an outdated version of Composer. Composer 2.0 is now available and you should upgrade. See https://getcomposer.org/2 Updating dependencies (including require-dev)

Fatal error: Allowed memory size of 1610612736 bytes exhausted (tried to allocate 134217736 bytes) in phar://C:/Dev/WinNMP/bin/composer/composer.phar/src/Composer/DependencyResolver/RuleSet.php on line 84

Check https://getcomposer.org/doc/articles/troubleshooting.md#memory-limit-errors for more info on how to handle out of memory errors.

Incremental92 commented 3 years ago

OK, I updated composer to V2 and restarted composer update. If this can help, I had a long update with : The "wikimedia/composer-merge-plugin" plugin was skipped because it requires a Plugin API version ("^1.0") that does not match your Composer installation ("2.0.0"). You may need to run composer update with the "--no-plugins" option. Loading composer repositories with package information Updating dependencies Lock file operations: 100 installs, 0 updates, 0 removals ....

Then ending with :

75 package suggestions were added by new dependencies, use composer suggest to see details. Package fzaninotto/faker is abandoned, you should avoid using it. No replacement was suggested. Package phpunit/php-token-stream is abandoned, you should avoid using it. No replacement was suggested. Generating autoload files

[RuntimeException] Could not scan for classes inside "tests/concerns/InteractsWithAuthentication.php" which does not appear to be a file nor a folder

update [--with WITH] [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--lock] [--no-install] [--no-autoloader] [--no-scripts] [--no-suggest] [--no-progress] [-w|--with-dependencies] [-W|--with-all-dependencies] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-autoloader] [--apcu-autoloader-prefix APCU-AUTOLOADER-PREFIX] [--ignore-platform-req IGNORE-PLATFORM-REQ] [--ignore-platform-reqs] [--prefer-stable] [--prefer-lowest] [-i|--interactive] [--root-reqs] [--] []...

Incremental92 commented 3 years ago

It didn't solved, I still can't log in my app

Incremental92 commented 3 years ago

In fact, the server was crashed with the following error for backend and frontend : Warning: require(): Invalid date.timezone value 'UTC+2', we selected the timezone 'UTC' for now. in C:\Dev\WinNMP\WWW\Meteo\vendor\composer\autoload_real.php on line 66

Warning: require(C:\Dev\WinNMP\WWW\Meteo\vendor\composer/../symfony/polyfill-php70/bootstrap.php): failed to open stream: No such file or directory in C:\Dev\WinNMP\WWW\Meteo\vendor\composer\autoload_real.php on line 66

Warning: require(): Invalid date.timezone value 'UTC+2', we selected the timezone 'UTC' for now. in C:\Dev\WinNMP\WWW\Meteo\vendor\composer\autoload_real.php on line 66

Fatal error: require(): Failed opening required 'C:\Dev\WinNMP\WWW\Meteo\vendor\composer/../symfony/polyfill-php70/bootstrap.php' (include_path='.;c:/dev/winnmp/include') in C:\Dev\WinNMP\WWW\Meteo\vendor\composer\autoload_real.php on line 66

I restored the backup !

rluders commented 3 years ago

Let's move the issue to the CORS repository, since it is related to that plugin and not really about the JWTAuth plugin. Closing this issue here.

https://github.com/rluders/oc-cors-plugin/issues/5