Make sure panic is not thrown when refresh token

Fixes #7695

Signed-off-by: Daniel Jiang <jiangd@vmware.com>
This commit is contained in:
Daniel Jiang 2019-05-07 19:51:09 +08:00
parent 78aea0920d
commit c16b44d30b

View File

@ -208,5 +208,9 @@ func RefreshToken(ctx context.Context, token *Token) (*Token, error) {
if err != nil {
return nil, err
}
return &Token{Token: *t, IDToken: t.Extra("id_token").(string)}, nil
it, ok := t.Extra("id_token").(string)
if !ok {
return nil, fmt.Errorf("failed to get id_token from refresh response")
}
return &Token{Token: *t, IDToken: it}, nil
}