fix: rp.RefreshAccessToken did not work (#216)
* oidc.RefreshTokenRequest cannot be used to in a request to refresh tokens because it does not explicitly include grant_types. * fix merge issue * undo accidental formatting changes
This commit is contained in:
parent
4b4b0e49e0
commit
88a98c03ea
1 changed files with 12 additions and 1 deletions
|
@ -547,14 +547,25 @@ func (t tokenEndpointCaller) TokenEndpoint() string {
|
||||||
return t.OAuthConfig().Endpoint.TokenURL
|
return t.OAuthConfig().Endpoint.TokenURL
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type RefreshTokenRequest struct {
|
||||||
|
RefreshToken string `schema:"refresh_token"`
|
||||||
|
Scopes oidc.SpaceDelimitedArray `schema:"scope"`
|
||||||
|
ClientID string `schema:"client_id"`
|
||||||
|
ClientSecret string `schema:"client_secret"`
|
||||||
|
ClientAssertion string `schema:"client_assertion"`
|
||||||
|
ClientAssertionType string `schema:"client_assertion_type"`
|
||||||
|
GrantType oidc.GrantType `schema:"grant_type"`
|
||||||
|
}
|
||||||
|
|
||||||
func RefreshAccessToken(rp RelyingParty, refreshToken, clientAssertion, clientAssertionType string) (*oauth2.Token, error) {
|
func RefreshAccessToken(rp RelyingParty, refreshToken, clientAssertion, clientAssertionType string) (*oauth2.Token, error) {
|
||||||
request := oidc.RefreshTokenRequest{
|
request := RefreshTokenRequest{
|
||||||
RefreshToken: refreshToken,
|
RefreshToken: refreshToken,
|
||||||
Scopes: rp.OAuthConfig().Scopes,
|
Scopes: rp.OAuthConfig().Scopes,
|
||||||
ClientID: rp.OAuthConfig().ClientID,
|
ClientID: rp.OAuthConfig().ClientID,
|
||||||
ClientSecret: rp.OAuthConfig().ClientSecret,
|
ClientSecret: rp.OAuthConfig().ClientSecret,
|
||||||
ClientAssertion: clientAssertion,
|
ClientAssertion: clientAssertion,
|
||||||
ClientAssertionType: clientAssertionType,
|
ClientAssertionType: clientAssertionType,
|
||||||
|
GrantType: oidc.GrantTypeRefreshToken,
|
||||||
}
|
}
|
||||||
return client.CallTokenEndpoint(request, tokenEndpointCaller{RelyingParty: rp})
|
return client.CallTokenEndpoint(request, tokenEndpointCaller{RelyingParty: rp})
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue