API tokens
An admin user that SSO manages has no password. Thus the REST, SOAP and GraphQL APIs refuse the usual admin token request of the user. With this feature, the user gets an admin API token after a re-authentication at the identity provider.
Turn on the feature
Section titled “Turn on the feature”-
Go to Stores > Configuration > Advanced > Admin > Visus Single Sign-On.
-
Set Allow API Tokens For Single Sign-On Accounts to Yes.
-
In API Token Lifetime (Minutes), enter the lifetime of each token. The default is 60 minutes.
-
Click Save Config.
-
Go to System > Permissions > User Roles.
-
For each role that needs API access, add the API Tokens For Single Sign-On resource under My Account.
If the admin token lifetime of Magento (OAuth > Access Token Expiration) is shorter, a token expires at the end of that lifetime.
Get a token
Section titled “Get a token”
-
Go to My Account, and open API Tokens.
-
Click Create Token.
-
In the Create API Token dialog, verify your identity with your identity provider.
-
Create the token.
-
Copy the token. You cannot see the token again after you close the window.
-
Click Done.
Use the token as a bearer token:
curl -H "Authorization: Bearer <token>" https://shop.example.com/rest/V1/store/storeViewsRevoke tokens
Section titled “Revoke tokens”Magento revokes all the admin tokens of a user, not one token. Thus a revoke also stops the tokens that the user got in another way.
- Your own tokens: on My Account > API Tokens, click Revoke All Tokens.
- The tokens of other users: go to System > Permissions > Visus Single Sign-On > API Tokens. Click Revoke All For User in the row of the user. To revoke the tokens of more than one user, select the rows, and use the Revoke All Tokens Of Users mass action.
The grid shows the unexpired tokens that SSO users got after a re-authentication. To see the grid, the role needs View API Tokens. To revoke, the role needs Revoke API Tokens.

How the module accepts the tokens
Section titled “How the module accepts the tokens”The token is an ordinary admin token of Magento. Each time an API reads the token, the module examines it:
- The module refuses an admin token of an SSO-managed user. This also applies to a token from a time before SSO managed the user.
- The exception is a token that the user got on the API Tokens page. The module accepts it until the lifetime of the module ends.
- If you turn off Allow API Tokens For Single Sign-On Accounts, the module refuses these tokens too.
The module does not change the tokens of customers and integrations.
The visus_admin_sso_clean_expired_api_tokens cron job deletes the records of the expired tokens every hour.