Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Supported way to get the token

未关闭
#3,806 1 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
45/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
活跃
技术栈
csharp, powershell

调研方向

Start by reviewing the authentication changes in #3789 and the former GraphSession access mentioned in the issue. Clarify how a Get-MgAccessToken command should return cached or fresh tokens, handle scopes, and document the supported usage; completion should include the command and its documentation.

由索引模型根据 Issue 内容生成。

描述

status:waiting-for-triage type:feature
Is your feature request related to a problem? Please describe the problem.

For a long time there was an undocumented way to get an access token from the current session using code like [Microsoft.Graph.PowerShell.Authentication.GraphSession]::Instance...
This is option now removed by #3789 because of assembly isolation

Describe the solution you'd like.

I would like a command that returns a cached or fresh (with -Fresh flag) access token as a secure string, so we can tell people to use that. And have that documented.
Maybe even with a way to specify the scopes, so it can also be used the get tokens for other applications.

$token = Get-MgAccessToken [[-Scope] ......] [-Fresh]
Additional context?

You're able to do:

  1. Fake request
  2. Return http response
  3. Read http request headers
  4. Extract token

Why not provide a way that just returns set token as a secure string?

Authentication is one of the most difficult things to grasp, being able to provide a way for users to just get an access token without tricks seems like a nice addition.

主要语言
C#
星标
901
派生
232
平均合并
1 天 9 小时
30 天内合并 PR
22

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

microsoftgraph/msgraph-sdk-powershell 的其他 Issue

查看 microsoftgraph/msgraph-sdk-powershell 的全部 Issue

相似的 Issue

更多 C# Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。