When a client issues a authorize request with response_type=code, authorize server gives an access_token without expires_in or refresh_token value even if grant_access! method is called with duration option.
I've tested this situation with following scenario.
In sever's authorize action, renders an application allowance form
In server's allow action, OAuth2::Provider::Authorization is constructed with @user and params with params[:client_id], params[:response_type], params[:redirect_uri]. Then it calls grants_access!(:duration => 3600) and redirect to client's redirect_uri with code parameter.
In client, client issue a POST request to http://oauth_server.dev/oauth/access_token with params[:grant_type] = "code", params[:code] = xxx, params[:client_id]=yyy and params[:client_secret]=zzz and The authorization server gives response with valid access_token but not refresh_token or expires_in values. I think those values should be in response.
In oauth2/model/authorization.rb, exchange! method just set refresh_token with nil with no condition check.
When a client issues a authorize request with
response_type=code
, authorize server gives anaccess_token
withoutexpires_in
orrefresh_token
value even ifgrant_access!
method is called withduration
option.I've tested this situation with following scenario.
authorize
action, renders an application allowance formallow
action, OAuth2::Provider::Authorization is constructed with@user
andparams
withparams[:client_id], params[:response_type], params[:redirect_uri]
. Then it callsgrants_access!(:duration => 3600)
and redirect to client'sredirect_uri
withcode
parameter.params[:grant_type] = "code"
,params[:code] = xxx
,params[:client_id]=yyy
andparams[:client_secret]=zzz
and The authorization server gives response with validaccess_token
but notrefresh_token
orexpires_in
values. I think those values should be in response.In
oauth2/model/authorization.rb
,exchange!
method just set refresh_token withnil
with no condition check.I think it should check whether
expires_in
parameter is set, and have to generaterefresh_token
in that case.