FetchRawUserInfo implements Provider.FetchRawUserInfo interface method. Linear doesn't have a UserInfo endpoint and information on the user is retrieved using their GraphQL API (https://developers.linear.app/docs/graphql/working-with-the-graphql-api#queries-and-mutations)
(token *oauth2.Token)
| 98 | // Linear doesn't have a UserInfo endpoint and information on the user |
| 99 | // is retrieved using their GraphQL API (https://developers.linear.app/docs/graphql/working-with-the-graphql-api#queries-and-mutations) |
| 100 | func (p *Linear) FetchRawUserInfo(token *oauth2.Token) ([]byte, error) { |
| 101 | query := []byte(`{"query": "query Me { viewer { id displayName name email avatarUrl active } }"}`) |
| 102 | bodyReader := bytes.NewReader(query) |
| 103 | |
| 104 | req, err := http.NewRequestWithContext(p.ctx, "POST", p.userInfoURL, bodyReader) |
| 105 | if err != nil { |
| 106 | return nil, err |
| 107 | } |
| 108 | req.Header.Set("Content-Type", "application/json") |
| 109 | |
| 110 | return p.sendRawUserInfoRequest(req, token) |
| 111 | } |
no test coverage detected