Im trying to install passport on my Laravel 9 project, but I get that error
Could not fetch https://gitlab.com/api/v4/projects/stella-maris%2Fclock/repository/archive.zip?sha=8a0a967896df4c63417385dc69328a0aec84d9cf, enter your gitlab.com credentials to go over the API rate limit I tryed to access this url but is blocked for me. How can I solve it.
This policy has been active at Github a long time regrettably. It is documented here and you can see your current status at https://api.github.com/rate_limit in the core section
Also see https://developer.github.com/v3/#rate-limiting:
There is nothing Composer can do to circumvent that, hence why it throws the verbose error:
Create a GitHub OAuth token to go over the API rate limit
You can do this at https://github.com/settings/tokens, and it needs to be done only once per installation as Composer remembers the token for subsequent requests.
Thanks, I solve it by connecting myself through a proxy server.
Related
I am using Laravel 7 and utilizing Laravel socialite package for the first time for authenticating with facebook.
The problem is I am on localhost and when I am redirected to facebook I am getting error saying
Facebook has detected that XYZ isn't using a secure connection to transfer information.
Until XYZ updates its security settings, you won't be able to use Facebook to log in to it.
I tried to configure my xampp to run localhost on https by following these methods
https://stackoverflow.com/a/28658969/12168002
https://www.youtube.com/watch?v=Mig9YPNiUZI
but none of them worked for me.
I watched few socialite installation videos and noticed that none of them was having secure connection but still able to authenticate user successfully.
Please highlight the actual cause of me getting this error and how can I fix this?
My application has an API that I consume from my JavaScript/Vue front end. Recently, I (unrelated) tried to unsecure Valet in order to share the site to perform webhook tests. I received a Brew 'Unable to determine linked PHP' error. Long story short I restored the symlink, updated composer dependencies and resecured Valet to ensure nothing was broken.
Upon loading my application, all calls to my Laravel Passport secured API are returning 401. My unit tests are all passing, so the non-javascript authentication is working.
Both the laravel_token and the x-csrf-token are being sent in the request header and I still have CreateFreshApiToken middleware in my Kernel.php.
Has anyone got any ideas as to where I can start to look to debug this?
If you've just recently upgraded to Laravel 5.6.30, this was a security patch with breaking changes.
Read upgrade notes here.
TL;DR
Call Laravel\Passport\Passport::withoutCookieSerialization() in your AppServiceProvider
i'm using Larave 5.4 passport to create SPA application. However, i was able to make authentication work. but access token are always short-lived tokens with 600s expiration time.
i could not increase expiration time with:
Passport::tokensExpireIn(Carbon::now()->addDays(15));
Passport::refreshTokensExpireIn(Carbon::now()->addDays(30));
it have no effect at all.
any help? thanks in advance.
Personal access tokens are always long-lived. Their lifetime is not modified when using the tokensExpireIn or refreshTokensExpireIn methods - as explained in Laravel's official documentation (https://laravel.com/docs/5.7/passport#personal-access-tokens).
The option of editing PassportServiceProvider.php in the vendor directory is a bad idea. Every time, you make an update (e.g composer update/install) or by another developer in production, code will be reverted to status quo, and it would start failing.
A better approach is to use Password Grant Tokens. The OAuth2 password grant allows your other first-party clients, such as a mobile application, to obtain an access token using an e-mail address / username and password. This allows you to issue access tokens securely to your first-party clients without requiring your users to go through the entire OAuth2 authorization code redirect flow. Be sure that you have duly installed passport (See Guide: https://laravel.com/docs/5.7/passport#installation), then run this command
php artisan passport:client --password
Having done this, you can request an access token by issuing a POST request to /oauth/token. Remember, this route is already registered by the Passport::routes method so there is no need to define it manually. If the request is successful, you will receive an access_token and refresh_token in the JSON response from the server. See payload sample below:
{
"grant_type" : "password",
"client_id":"your-client-id",
"client_secret":"your-client-secret",
"username":"twady77#gmail.com",
"password":"123456",
"scope":""
}
Sample response:
{
"token_type":"Bearer",
"expires_in":1296000,
"access_token":"eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImp0aSI6IjVkMWJjN2NhOTU0ZWU2YTZmOGNkMGEyOTFjOTI5YzU4Zjk3ODk3M2YxZDJmNjQ2NjkyZjhjODQyZjYxNTBjZGRiYzMwY2RjMzRmZjJhYmU1In0.eyJhdWQiOiI4IiwianRpIjoiNWQxYmM3Y2E5NTRlZTZhNmY4Y2QwYTI5MWM5MjljNThmOTc4OTczZjFkMmY2NDY2OTJmOGM4NDJmNjE1MGNkZGJjMzBjZGMzNGZmMmFiZTUiLCJpYXQiOjE1NDkyOTI5MjcsIm5iZiI6MTU0OTI5MjkyNywiZXhwIjoxNTUwNTg4OTI3LCJzdWIiOiIxIiwic2NvcGVzIjpbXX0.cSvu30xAT-boA5zmVuxTr0TfH_5MYuVWYi6NVQRbryZSswt8EAFTi5QXHH1f0O63DWnLA6VFBS2AfDe4-ryJZACDnt4gtPJOeuu1rNMZ53MU1vjxnyC8FsYz8v9vmYJsZPKqfTJpuJFYRFh7kkV7uWAmrEkuF3POnDn-GjW50f4i26lIZW5ta5j4nZQrIJCQUEzwXaQtn9H-qef3bTWAaplWaV-k7Blic-0TXXVfWa_CdoKCAzHROVBRWY1Idhe1LJkvGKldUGzUfliiB1x7EVVInq94VYEP5d9__90Z2UMUn5dCEgWkXvcEHYy87_4OSwu4TQk_f3hD82OVOEtJGgPyJqK51WqnQCBYwNtxNjqAW2oaMgpritp3G8nccUiyhkE4Pd_kj3cb2OvSNRXdDS9z-RnJb1OXUkja-4Xe_JfIWUjlTnkss18xMg89hcU_3xtBwUXBWHgffzcbNoI1oOwUL6Whekduiy8csf665v0cnzkPXISmvyGhiMseIlBEN9m9uESaJqD_g7WzbsEs7meI0CAF3230UgrI1MdYSAJMW0mMPF9EScH31a_Qpde5O233Ty6-S4NAp323Wneqs_jpGSfw81CvoI1JeY0hZccRC-MBBsQ2Ox7AM36H5L3p-ybricmT3oCcHEqhufq-ygyfqk1RufJwwRblwYPyaJE",
"refresh_token":"def50200c6b2378110190ac28d9d55f622885bb0b470a20543a6f1eefb18ed93c57b7040dc4db9444aa8853209bde9d5443a407d43fcaf1deb2e1f3f5ea3ce7431c4ec5e111bdc0cc71ca76034cd2a884441c51e4c922dddfa3f6e3a3fa8e1fbb8efe4581ce70d76590e732b3fa8b0c41a8abff4a8759f9dd1cc3ae46134fb67a8f25cd79e3229f6ee3238701ebfe0e8b0e2f14bd13c7fde3f813708a3de9928c8e992850994ca97bf61984cdb846bd0d72916312d9985472fc4293a3b3f2c55e1ef19621ef009623a6780f800ece9c8d835871dc795fda5daa43ac3fdae467e66b46e4eb73d53b8cb821522ee60979711c28c54fb2085f6000ac7e96e019ce51b9f92ea3fa2028aa0238fc3dca9c900e8dd77907782b22482f95a5e55708e5bda8c28f3732ff55e361f08447b33fe05d5646cecfb9faed462d327efdcc2a3742f46f9f825275d296b4ced25c05f3b6add68f43a2b448e4523d5410c631dc45bba"
}
Try to use this library: https://github.com/GeneaLabs/laravel-caffeine , and you can look laravel session config options
tokenExpireIn() instead of refreshTokensExpireIn() use then solve tokenExpireIn problem.
for passport grant token
Passport::tokensExpireIn(Carbon::now()->addDays(10));
Passport::refreshTokensExpireIn(Carbon::now()->addDays(15));
This is only adding 10 minutes of expiry time. Don't know how and why, but instead changing internal codes. I Changed
Passport::tokensExpireIn(Carbon::now()->addDays(10000));
Passport::refreshTokensExpireIn(Carbon::now()->addDays(12000));
Now it's adding 7 days of expiry time. Seems like addDays function adding 10000 minutes.
I have the same issue before for my application, I spent two days try to find what is the problem, The best solution that I came up with is to change the expire date directly in the PassportServiceProvider
Go to vendor/laravel/passport/src/PassportServiceProvider.php line 108
new PersonalAccessGrant, new DateInterval('P1Y')
for example to set the expire date to one week
new PersonalAccessGrant, new DateInterval('P1W')
I know this is a bad solution for fixing the issue, recently I have found the same issue on Laravel Git repo
https://github.com/laravel/passport/issues/47
Using version ~2.0#dev for yiisoft/yii2-jui ./composer.json has been
updated Loading composer repositories with package information
Updating dependencies (including require-dev)
Could not fetch https://api.github.com/repos/jquery/jquery, enter your
GitHub credentials to go over the API rate limit A token will be
created and stored in
"C:/Users/nimmy/AppData/Roaming/Composer/auth.json", your password
will never be stored To revoke access to this token you can visit
https://github.com/settings/applications Username:
I am getting above error while I try to install yii2/jui. I want do use a datepicker. I tried to install datepicker and composer also, but I am getting the same error.
What could I try next?
You should try composer self-update. Then run update again. Keep in mind, that GitHub imposes a limit of 60 requests per hour for unauthorized user's IP!
By entering your credentials, or alternatively it may ask you for your Authorization Token (which you can generate inside GitHub and provide to composer when prompted for it), you should extend your limit to 5000 requests per hour.
If everything is done correctly, but composer keeps saying that the Authentication Token is wrong, try making a new GitHub account and try updating again providing the credentials for the new account. In the past I had a problem when an account had the wrong authorized requests counter stored by GitHub which was counting all requests as unauthorized, making new account worked like a charm, although figuring out the problem and reporting it worked also ;)
I am just following instructions from the yii website and don't really understand composer. I followed the instructions from here http://www.yiiframework.com/doc-2.0/guide-start-installation.html
The authentication seems to be working but then it prompts me for the username/password again and again.
Anyone got some things I can check to see why it keeps prompting?
[root#dndbox html]# composer create-project --prefer-dist --stability=dev yiisoft/yii2-app-basic basic
Installing yiisoft/yii2-app-basic (dev-master b528289495bf9721d2b8c628d69caad42e45b0ce)
- Installing yiisoft/yii2-app-basic (dev-master master)
Downloading: connection...
Could not fetch https://api.github.com/repos/yiisoft/yii2-app-basic/zipball/b528289495bf9721d2b8c628d69caad42e45b0ce, enter your GitHub credentials to go over the API rate limit
The credentials will be swapped for an OAuth token stored in /root/auth.json, your password will not be stored
To revoke access to this token you can visit https://github.com/settings/applications
Username: *.com
Password:
An existing OAuth token for Composer is present and will be reused
Could not fetch https://api.github.com/authorizations, enter your GitHub credentials to go over the API rate limit
The credentials will be swapped for an OAuth token stored in /root/auth.json, your password will not be stored
To revoke access to this token you can visit https://github.com/settings/applications
Username: *.com
Password:
An existing OAuth token for Composer is present and will be reused
Could not fetch https://api.github.com/authorizations, enter your GitHub credentials to go over the API rate limit
The credentials will be swapped for an OAuth token stored in /root/auth.json, your password will not be stored
To revoke access to this token you can visit https://github.com/settings/applications
Username:
==================================== EDIT 1 =====================================
If I visit the URL provided I get a error message in the json, https://api.github.com/authorizations
{
"message": "API rate limit exceeded for xxx.xxx.xxx.26. (But here's the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details.)",
"documentation_url": "https://developer.github.com/v3/#rate-limiting"
}
It may helps you more. Follow the steps:
Create/Sign in into github account.
Go to Profile>>Settings>>Personal access tokens (OR) click on this https://github.com/settings/tokens.
Click on Generate new token
Select the appropriate scopes and click Generate token.
Copy the the token Key and past it in composer when the composer want you the Token(like: Token (Hidden):)
Now it will enter into the installation process.
Good Luck...
see this answer on the forum
http://www.yiiframework.com/forum/index.php/topic/60340-issue-while-installing-yii-2/page__view__findpost__p__269389
it helped me
Create a Github account.
Go to https://github.com/s...gs/applications and delete your previous token generated during the installation of yii2
Create a new token.
Run this: composer config -g github-oauth.github.com
Retry again with the yii2 installation