-
Notifications
You must be signed in to change notification settings - Fork 167
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Custom grant_type requires custom storage_type #101
Comments
See pull #102 for my fix to this problem. |
Can you show your config?
…On May 6, 2017 13:07, "Yang He" ***@***.***> wrote:
@eborned <https://github.com/eborned> I am having the same issue when
trying to implement my own grantTypes. However, your #102
<#102> seems not working,
it still returns the same "unknown storage key" error.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#101 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AD4OYpzz3Au30mdnc7lD6TgWmfomUuD3ks5r3FRigaJpZM4Jqq13>
.
|
Hi @eborned, please see my config in below, it is actually same as you demonstrated above. 'modules' => [
'oauth2' => [
'class' => 'filsh\yii2\oauth2server\Module',
'tokenParamName' => 'access_token',
'tokenAccessLifetime' => 3600*24,
'storageMap' => [
'user_credentials' => 'api\common\models\User',
'user_credentials_custom' => 'api\common\models\User',
],
'grantTypes' => [
'user_credentials' => [
'class' => 'OAuth2\GrantType\UserCredentials',
],
'user_credentials_custom' => [
'class' => 'api\components\OAuth2\GrantType\WechatAppCode',
'storageName' => 'user_credentials_custom',
],
'refresh_token' => [
'class' => 'OAuth2\GrantType\RefreshToken',
'always_issue_new_refresh_token' => true,
],
],
],
...
...
], |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I've been working on a custom grant_type to incorporate OTP in the normal user_credentials grant_type. This requires a storageMap property with the same name. The main problem is that the base library (bshaffes/oauth2) only accepts a few fixed values as keys for the storage map:
So this won't work:
It returns the error:
"unknown storage key "user_credentials_otp", must be one of [access_token, authorization_code, client_credentials, client, refresh_token, user_credentials, user_claims, public_key, jwt_bearer, scope]"
I've forked the library and added a custom storageName property to the grantType configuration. This will allow me to override the storageMap key for a specific grantType.
Am I the only one having this problem? And would this be something we can add to the library? It's backwards compatible and I think the only way to support this right now.
The text was updated successfully, but these errors were encountered: