Auth Providersを作成。Consumer KeyとConsumer Secretを適度な文字列でよい
Callback URLをコピー
Github側で認証Appを作成
Authorization callback URLに↑でコピーしたURLを記入。Homepage URLにはHomeのURL
HomeのURLはアイコンをクリックしてユーザー名を確認、形式は「https://github.com/ユーザー名」
Consumer KeyとConsumer Secretを取得
Consumer KeyとConsumer SecretをSalesforce側へ再設定
指定ログイン情報を登録する
プロファイルで許可
個人設定で許可
注意:保存後、認証ページに移動される、その後、StautsがAuthenticatedになる
test code
HttpRequest req = new HttpRequest();
req.setEndpoint('callout:myGitNamed/user');
req.setMethod('GET');
Http http = new Http();
HTTPResponse res = http.send(req);
System.debug(res.getBody());