oauth icon indicating copy to clipboard operation
oauth copied to clipboard

Support more auth endpoints

Open v-braun opened this issue 4 years ago • 1 comments

Hi,

this is a draft to support other endpoints than GitHub.

In my specific case, I had to use Microsofts Auth Endpoint wich is a bit different than that from GitHub. See details here.

I needed the support of additional post parameters in the AccessToken function and also to handle JSON based responses.

My solution is not that generic (to support others) as I wanted, because I had to focus on my specific case but maybe it is a good starting point for other auth endpoints.

v-braun avatar Jan 22 '21 21:01 v-braun

@mislav I see already that there are some tests failing (not only linter tests).

I am working on a GO based desktop app based on wails. Within the app I am authenticating against office365 wich has some differences to GitHub within the open ID protocol details.

1.: I have to specify additional query parameters within the browser URL browser.OpenURL wich are:

"response_type": "code",
"response_mode": "query"

see details here

2.: flow.AccessToken need in my case some additional parameters that has to been posted, this are:

"grant_type":  "authorization_code",
"redirect_uri": "redirect url",

see details here

3.: api.PostForm handle payload that is provided via a JSON content type. O365 response is a JSON. For that I analyze the contentype ad parse a dictionary based on this. FormResponse.Get has a check and returns the accesstoken (and refreshtoken) based on the previouse received ContentType (see here).

Please see this as a working draft, we can also close the PR til I have refactored the code and fixed the Tests. I am right now busy on my project but hopefully can contribute here again till end of this week.

v-braun avatar Feb 03 '21 12:02 v-braun

This seems incredibly stale so I'm going to go ahead and close this to get it off our books 🙏

williammartin avatar Apr 03 '24 10:04 williammartin