📜  热获取 access_token 而不是 url - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:01:36.845000             🧑  作者: Mango

代码示例1
var urlString = 'http://localhost:3000/_oauth/google#access_token=ya29.5HxuYol1Io8JLeGePDznbfkkwu_PC4uodKwG8_1clFYAn9AgdOV1WGpOTNQP3s76HAsn7Y4zWw&token_type=Bearer&expires_in=3600';

var url = new URL(urlString);
// OR: If you want to use the current page's URL
var url = window.location;

var access_token = new URLSearchParams(url.search).get('access_token');