PHP,邮递员-获得带有授权令牌载体的请求确实起作用

时间:2020-06-08 18:18:10

标签: php get request postman

authorizationResponse = {type: "authorization_response",response: {"access_token":"3VH1nr_EukBPqelzH5h5INuwaMh4rIsw","id_token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJlbWFpbCI6Im9ubGluZWludm9pY2Uy
NjE5QGdtYWlsLmNvbSIsImVtYWlsX3ZlcmlmaWVkIjp0cnVlLCJ1c2VyX21ldGFkYXRhIjp7ImZpcnN0X25hbWUiOiJIIiwiZ2l2ZW5OYW1lIjoiQmVhbGUiLCJsYXN0X25hbWUiOiJCZWFsZSIsIm5hbWUiOiJIIiwidXNlcl9wcmVmZXJlbmNlcyI6eyJQYXBlcmxlc3MiOiJmYW
xzZSIsIlByb21vdGlvbmFsU3RhdHVzIjoiZmFsc2UiLCJQcm9tb3Rpb25hbENvbW1UeXBlIjoiRW1haWwiLCJTZXJ2aWNlQWxlcnRzQ29tbVR5cGUiOiJFbWFpbCIsIlNlcnZpY2VBbGVydHNTdGF0dXMiOiJmYWxzZSIsIlBob25lTnVtYmVyIjoiIiwiTW9iaWxlTnVtYmVyIjoi
IiwiT0JQU3RhdHVzIjoidHJ1ZSIsIklzU2V0dGluZ1VwZGF0ZWQiOiIifSwiZGVmYXVsdF9hY2NvdW50IjoiNDA2NDQxMCJ9LCJ1c2VyX2lkIjoiYXV0aDB8NWUwYmM4OGY0MjhiM2IxMDMzZTVhMzc0IiwiYXBwX21ldGFkYXRhIjp7ImZpc191c2VybmFtZSI6IjEyMzllODlhNT
ExZDRkYzQ4YjU0ZTQ2ZWE2NDBiZTk2IiwidXNlcl9yb2xlIjoiQ3VzdG9tZXIiLCJjZGhfY29udGFjdF9wcm9maWxlX2lkIjoiMzcwMTExNSIsInJlZ2lzdHJhdGlvbl9zdGF0dXMiOiJDRCIsInVzZXJfdHlwZSI6Ik9SIiwiZmlzX3N5bmNfc3RhdHVzIjoiQ0QiLCJzc29fZmxh
ZyI6Ik4iLCJjZGhfaWQiOiIzNTkzNDg1IiwibXJfb3JpZ2luYWxfaWQiOiIifSwiaWRlbnRpdGllcyI6W3sidXNlcl9pZCI6IjVlMGJjODhmNDI4YjNiMTAzM2U1YTM3NCIsInByb3ZpZGVyIjoiYXV0aDAiLCJjb25uZWN0aW9uIjoiVXNlcm5hbWUtUGFzc3dvcmQtQXV0aGVudG
ljYXRpb24iLCJpc1NvY2lhbCI6ZmFsc2V9XSwiaXNzIjoiaHR0cHM6Ly9hdXRoLnJlcHVibGljc2VydmljZXMuY29tLyIsInN1YiI6ImF1dGgwfDVlMGJjODhmNDI4YjNiMTAzM2U1YTM3NCIsImF1ZCI6ImFrN2czc3pJNTV6ZVQzWWR2c2FIcktCTVN6dWYwN1JqIiwiaWF0Ijox
NTkxNjM5OTY2LCJleHAiOjE1OTE2NDIwNjZ9.O6Lr6mwdRDGnkajLvjles5OZUE6bdgeIc5NDmerKkyk","scope":"openid email user_metadata user_id app_metadata identities given_name offline_access","expires_in":86400,"refresh_token
":"wOSUKBkpPBE5cP2Fvjhqk_IyaVaUe1Yn-PMDlqvz2PiDr","token_type":"Bearer","state":"-cnRVfTo5leolNpTONy-08usnorvye89"}};v

在此页面上,我得到了id_token,因为我需要将其放在标头中以获取另一个页面,但是当我这样做时,我无法获得JSON页面,而是收到了简单的HTML页面,即不是我所需要的。我也尝试过邮递员,我在邮递员中复制了所有标头和URL,但无法获得所需的良好响应。我的标题看起来像这样:

authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJlbWFpbCI6InAzcmVwdWJsaWMxMEBnbWFpbC5jb20iLCJlbWFpbF92ZXJpZmllZCI6dHJ1ZSwidXNlcl9tZXRhZGF0YSI6eyJmaXJzdF9uYW1lIjoiUDMiLCJsYXN0X25hbWUiOiJXQyIsIm5hbWUiOiJQMyBXQyIsInVzZXJfcHJlZmVyZW5jZXMiOnsiUGFwZXJsZXNzIjpmYWxzZSwiUHJvbW90aW9uYWxTdGF0dX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5MTY0MTI3MH0.RnPasIlFFHOhn7yvs7aHKepLZqdlobM3rAJH1TzxfNU

但是有些东西行不通,没有任何帮助,至少我如何能在邮递员那里得到良好的答复?

1 个答案:

答案 0 :(得分:0)

所以,据我所知,您在使用 Postman 的授权标头承载令牌发送请求时遇到问题?

如果确实如此,这里是如何做到的(只需将标记放在右边的表格中,当然没有引号)=>

example of how to use bearer auth header

如果不是你问的,那我尽力帮忙^^