9
votes
Accepted
How to use customer token to access my account Query or Mutation in GraphQl
Please try this:
Step 1: Get a bearer token:
You can get a token by executing the signup mutation in the playground to create a new user. This is the signup mutation I ran:
Request:
mutation {
...
9
votes
Magento2 How to set expiration time for token
Install Magento from github.com/magento/magento2.git and then use the steps from the documentation page about Token-based authentication
On Github, you should look at branch '2.2.0-preview' or '...
5
votes
Magento 2: Force Sign-In not working
Had the same question while reading Magento User Guide when first saw this button. And here is the answer from the guide:
"Revokes the OAuth access tokens that are associated with the customer
...
4
votes
Accepted
Retrieve guest cart using token in Magento 2
Add this dependency to your class constructor:
private $quoteIdMaskFactory;
public function __construct(
....
\Magento\Quote\Model\QuoteIdMaskFactory $quoteIdMaskFactory,
....
) {
....
...
4
votes
Accepted
Magento 2.4.4 - issue with setup:di:compile
Make sure you remove all modules from the vendor folder before updating to a complete new Magento version. I suspect some files are hanging in IDE or Docker sync.
So: rm -rf vendor/* && ...
3
votes
How to use customer token to access my account Query or Mutation in GraphQl
The resulting token should be used in subsequent requests in the Authorization header as a Bearer token ex:
Authorization: Bearer {{resultFromGenerateCustomerToken}}
I don't think ChromeQL allows ...
3
votes
Accepted
Access Token Expiration settings have no effect
I found the solution. There is another setting here:
I set the expiration here to 600 minutes and it works perfectly.
2
votes
Magento2 How to set expiration time for token
For anyone using the Web API, you may only need to allow anonymous access for simple tasks such as fetching products for your custom frontend/client - no need for an access token.
Admin > Stores &...
2
votes
Accepted
SOLVED - Api token request Curl returns NULL
You have to add this line to your code
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER , false);
like this
$adminUrl='https://www.xxxxxxx.com/rest/V1/integration/admin/token';
$ch = curl_init();
$data = ...
2
votes
Mage 2 Customer Token Error For Some Accounts
You're much likely to encounter a bug on core. A solution suggested by the user on github is clear the DB table oauth_token_request_log. You may have a try.
Source: https://github.com/magento/...
2
votes
Get customer details by using Authentication Token
webapi.xml
<route url="/V1/test/most/" method="GET">
<service class="Vendor\Module\Api\TestRepositoryInterface" method="getTest"/>
<resources>
<resource ref="self"/>
...
2
votes
Accepted
Magento 2 : How to programmatically create and display bearer token on admin screen?
You can use POST /V1/integration/admin/token API get bearer token for admin as mention in devdocs here.
But you'll need admin username and password which cannot be programatically fetched (well admin ...
2
votes
Create and update rp_token in Magento 2
This is how Magento itself does it:
// This line create a new token :
$newPasswordToken = $this->mathRandom->getUniqueHash();
// Get the secure data from the customer
$customerSecure = $this-&...
2
votes
Accepted
Magento 2 - Customer/Token Rest API issue
For customer token if you want it store wise then you need to pass store_code in the API url
POST <host>/rest/<store_code>/V1/integration/customer/token
But if you haven't configure any ...
2
votes
Get User Details by Access Token From Admin
First create token from Admin->System->integrations then use below code.
$ch = curl_init("http://your_domain.com/index.php/rest/V1/customers/search?searchCriteria");
$token = 'your_token';
...
2
votes
Error while fetching a request token using postman
did you resolve it?
With Postman if I try oauth integration I got the same error. I've Magento 2.3.4.
Best Regards,
Francesco
2
votes
Magento 2: How to get Admin Token via Rest API in Postman?
POST ==> https://example.com/index.php/rest/default/V1/integration/admin/token
Header ==> Content-Type application/json
Body ==> raw {"username": "name", "password&...
2
votes
Magento 2.4.4 - issue with setup:di:compile
For me, it is because of the Smile_ElasticsuiteCore extension issue with PHP 8.
Seems not compatible with PHP 8. Cannot use 'match' as an identifier. It is a reserved keyword since PHP 8.0
See below ...
2
votes
Accepted
Customer login not working after removing extension Magento 2 / Eway
this path is issue , and it is store in your database ,so error occurs ,
Find this in your Magento database in all tables.& Delete those entries.
Eway\EwayRapid\Model\Customer\Token\Backend
1
vote
Error while fetching a request token using postman
I know its too late but if someone else is facing the same issue then this would probably help:
Check and remove an entry for the consumer id in oauth_token table.
Ref: https://github.com/magento/...
1
vote
Magento 2 REST API: Custom API with customer_token expecting string[] instead of string
Fixed it by including these comments over the function in the interface:
/**
* GET for wishlist api
* @param string $customerId
* @return string
*/
1
vote
Accepted
how to capture braintree using customer token in magento2
Magento provides API to work with payment tokens. The PaymentTokenManagementInterface contains a list of methods to retrieve tokens:
getListByCustomerId
getByPaymentId
getByGatewayToken
...
1
vote
Magento2 How to set expiration time for token
Yes, you can generate tokens by using the only username.
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$tokenModelFactory = $objectManager->get('Magento\Integration\Model\...
1
vote
Magento 2 - Customer/Token Rest API issue
Instead of using /rest/all/V1/integration/customer/token
use this endpoint /rest/V1/integration/customer/token and you will get token.
1
vote
Magento variable for access token
Magento has talked about all environment variables in the link whichever you have shared.
I hope, you want to save the API token and fetch it on controller to trigger web service call right. If so, ...
1
vote
Accepted
getting "Consumer is not authorized to access %resources" when using rest API in magento2
The user api needs to have a role with permissions to access that resource.
As a debug method though, I would first try to var_dump($token) to make sure you are first getting the token.
1
vote
Unable to get access_token for Magento2.0
Endpoint
POST http://<host>/rest/default/V1/integration/admin/token
Header
Content-Type application/json
Payload
{
"username": "admin",
"password": "123123q"
}
Response
Magento returns ...
1
vote
You did not sign in correctly or your account is temporarily disabled. In Magento 2 Admin panel Token
Get Admin Token
Please check your URL action [It must be POST]
magento.host/index.php/rest/V1/integration/customer/token?admin&password=admin123
it will generate admin token.
The above ...
1
vote
Magento 2 token integration error
There are two types of authentication available in magento 2.
One is via admin another is via customer.
You can use below api to get the authenticated token which will be used to run all api having ...
1
vote
Magento 2 token integration error
Right now you are able to access only that api which can be accessed anonymously. Now you are accessing a api which need a authentication key/access token to assure that you are a registered customer ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
token × 73magento2 × 45
rest-api × 31
api × 12
magento-2.1 × 9
customer × 9
oauth × 9
magento2.3 × 5
magento2.4 × 5
admin × 4
access × 4
customer-account × 3
braintree × 3
authorize × 3
magento-1.9 × 2
php × 2
orders × 2
login × 2
soap × 2
graphql × 2
curl × 2
postman × 2
consumers × 2
magento2.2 × 1
cart × 1