LoginSignup
1
1

Postmanのまとめに戻る

いつもは開発者環境に接続して色々と遊んでいるのですが、違う環境に接続した後に元の開発者環境に接続すると何故かエラーになります。エラーコードは401です。特別に何かを触ったような記憶はない。

[{"message":"Session expired or invalid","errorCode":"INVALID_SESSION_ID"}]

グーグルさんで検索してみると同じ症状の質問/回答があります。

ベストアンサーのリンクを読むと

I actually fixed this after banging my head on it forever. You need to go into the settings tab and turn on the Follow Authorization Header setting.

確かに私の設定ではFollow Authorization headerはoffになっていました。

image.png

ここをonにすると機能します。
しかし、この設定は何だろう?

Retain authorization header when a redirect happens to a different hostname.
別のホスト名へのリダイレクトが発生した場合でも、認証ヘッダーを保持します

リダイレクト? う~ん、そう言えばコンソールを見ていると不思議なことに302のリダイレクトが発生していますね。

image.png

変数の_endpoint に 

https://brave-koala-c0o5lf-dev-ed.trailblaze.lightning.force.com 

を設定していますが、以下にリダイレクトされています。

https://brave-koala-c0o5lf-dev-ed.trailblaze.my.salesforce.com

試しに先程のFollow Authorization headerをoffにして_endpointにリダイレクト先を設定すると問題なく機能します。やはりリダイレクトが問題だったようです。

私の認識ではlightning.force.com は変わらないだったのですが....

image.png

インスタンスURLをみたらmy.salesforce.comになっていますね。こっちを_endpointにセットしたほうがよさそう。

image.png

そういえば、先程の記事の別の回答にもあったな。

I'm here in 2021 and for me the solution was not 'Follow Authorization Header', but the access token had a different instance_url than expected. Use this instance_url value in _endpoint and you are fine.

追記

見落としていました...

In the _endpoint row, CURRENT VALUE column, paste the instance_url value that you copied in step 9.

Quick Start: Connect Postman to Salesforce

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1