Skip to content
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

Refresh token is not work #3

Open
chanchaitdg opened this issue Apr 8, 2021 · 3 comments
Open

Refresh token is not work #3

chanchaitdg opened this issue Apr 8, 2021 · 3 comments

Comments

@chanchaitdg
Copy link

Access token after refresh token is not replace on http request for send push notification.
HTTP request still use previous access token.

@Mike-mei
Copy link
Contributor

Mike-mei commented Apr 8, 2021

Which method do you use to refresh token? Please check whether this error is reported when you refresh token.

@chanchaitdg
Copy link
Author

chanchaitdg commented Apr 8, 2021

on executeApiOperation method: src/push/core/pushclient.go

when access token expried.
isNeedRetry method get new access token but Authorization access token in request.Header is not change.

Maybe change on sendHttpRequest method: src/push/core/pushclient.go for fix it.


func (c *HttpPushClient) sendHttpRequest(ctx context.Context, request *httpclient.PushRequest, responsePointer interface{}) error {
	request.Header = []httpclient.HTTPOption{
		httpclient.SetHeader("Content-Type", "application/json;charset=utf-8"),
		httpclient.SetHeader("Authorization", "Bearer "+c.token),
	}

	resp, err := c.client.DoHttpRequest(ctx, request)
	if err != nil {
		return err
	}

	if err = json.Unmarshal(resp.Body, responsePointer); err != nil {
		return err
	}
	return nil
}

@Mike-mei
Copy link
Contributor

Mike-mei commented May 7, 2021

This issue has been solved in the latest commit, please refer to afaab2f

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants