Owain
12/09/2023, 7:04 PMredirect_uri
passed to it, but I can't see where in the appsettings I can apply this value. I can set the client key and client secret, there is even an option for "AuthorizationRequestsRequireRedirectUri": true,
which makes me thing I should be able to add the RedirectUri somehow. Has anyone found a way to do this?
Thanks.Anders Bjerner
12/09/2023, 7:45 PMjson
{
"Alias": "mastodon",
"DisplayName": "Mastodon",
"ApiHost": "https://umbracocommunity.social",
"IdentityHost": "https://umbracocommunity.social",
"TokenHost": "https://umbracocommunity.social",
"RequestIdentityPath": "/oauth/authorize",
"RequestTokenPath": "/oauth/token",
"RequestTokenFormat": "Querystring",
"ClientId": "aaaaaaaaaaaaa",
"ClientSecret": "aaaaaaaaaaaaa",
"AuthorizationUrlRequiresRedirectUrl": true
}
Anders Bjerner
12/09/2023, 7:46 PMAuthorizationRequestsRequireRedirectUri
. Not sure where you got this from. AuthorizationUrlRequiresRedirectUrl
does the trickOwain
12/09/2023, 8:02 PM"AuthorizedServices": {
"TokenEncryptionKey": "",
"Services": {
"MastodonService": {
"DisplayName": "Mastodon",
"ApiHost": "https://umbracocommunity.social",
"IdentityHost": "https://umbracocommunity.social",
"TokenHost": "https://umbracocommunity.social",
"RequestIdentityPath": "/oauth/authorize/",
"RequestTokenPath": "/oauth/token",
"RequestTokenFormat": "FormUrlEncoded",
"AuthorizationRequestsRequireRedirectUri": true,
"UseProofKeyForCodeExchange": true,
"ClientId": "<<client_id>>",
"ClientSecret": "<<cliend_secret>>",
"Scopes": "read write "
}
}
}
Owain
12/09/2023, 8:03 PMredirect_uri
with a value of urn:ietf:wg:oauth:2.0:oob
for testing just now. This value will change to a live domain once happyAnders Bjerner
12/09/2023, 8:06 PMurn:ietf:wg:oauth:2.0:oob
is for testing certain scenarios locally. It will not work with the authorized services package.
If you change AuthorizationRequestsRequireRedirectUri
to AuthorizationUrlRequiresRedirectUrl
the package should add the correct redirect URI to the query string. In my case when running locally, the redirect URI is https://localhost:44307/umbraco/api/AuthorizedServiceResponse/HandleOAuth2IdentityResponse
.Owain
12/09/2023, 8:18 PMAnders Bjerner
12/09/2023, 8:24 PMAnders Bjerner
12/09/2023, 8:25 PMOwain
12/09/2023, 8:42 PMOwain
12/09/2023, 8:43 PMOwain
12/09/2023, 8:43 PMOwain
12/09/2023, 8:43 PMOwain
12/09/2023, 8:43 PMAnders Bjerner
12/09/2023, 8:46 PMOwain
12/09/2023, 8:47 PMOwain
12/09/2023, 9:00 PMAuthorizationUrlRequiresRedirectUrl": true|false,
will make a PR and ask if this is correct 😄Anders Bjerner
12/09/2023, 9:06 PMOwain
12/09/2023, 9:09 PMAuthorizationRequestsRequireRedirectUri
from. I wonder if it was just intellisense catching me out as it looks similar.Owain
12/09/2023, 9:11 PMAnders Bjerner
12/09/2023, 11:04 PM"CanManuallyProvideToken": true
which then let's you enter the access token manually. When enabled, the UI looks like this:Owain
12/09/2023, 11:06 PMAnders Bjerner
12/09/2023, 11:11 PMappsettings.json
or a secret manager (like Cloud has).
Once you have added an access token to the Authorized Services package, it will help you make authenticated requests to the underlying API. But the Authorized Services package doesn't really know about the underlying API, which endpoints it has etc. So you might want to grab a package for that specific API instead.
Like on the #H5YR site, you could use my Mastodon API wrapper: https://github.com/abjerner/Skybrud.Social.Mastodon
The README has examples on how to both read statuses and post new statuses.Anders Bjerner
12/09/2023, 11:13 PMOwain
12/11/2023, 9:03 AM