consent: Handles consent error properly in SQL DBAL
@@ -267,7 +267,7 @@ func newSQLHandledConsentRequest(c *HandledConsentRequest) (*sqlHandledConsentRe
func (s *sqlHandledConsentRequest) toHandledConsentRequest(r *ConsentRequest) (*HandledConsentRequest, error) {
var idt map[string]interface{}
var at map[string]interface{}
- var e RequestDeniedError
+ var e *RequestDeniedError
if err := json.Unmarshal([]byte(s.SessionIDToken), &idt); err != nil {
return nil, errors.WithStack(err)
@@ -275,9 +275,13 @@ func (s *sqlHandledConsentRequest) toHandledConsentRequest(r *ConsentRequest) (*
if err := json.Unmarshal([]byte(s.SessionAccessToken), &at); err != nil {
return nil, errors.WithStack(err)
}
+
+ if len(s.Error) > 0 && s.Error != "{}" {
+ e = new(RequestDeniedError)
if err := json.Unmarshal([]byte(s.Error), &e); err != nil {
return nil, errors.WithStack(err)
}
+ }
return &HandledConsentRequest{
GrantedScope: stringsx.Splitx(s.GrantedScope, "|"),
