AuthorizsedServices with Google Admin
# help-with-umbraco
a
I've been playing w/ having Google user authentication on a site - I've go that working perfectly fine. What I need to do is upon login of a user - check their existing roles in Google (Groups ---- Google Admin SDK?) and see what role they are in for further Umbraco Permissions setup. I'm using umbraco 13 I was thinking of using the AuthorizsedSerives plugin - and have setup a service as such (just tinerking):
Copy code
json
"AuthorizedServices": {
    "TokenEncryptionKey": "",
    "Services": {
        
            "google-directory": {
                "DisplayName": "Google Directory",
                "ApiHost": "https://admin.googleapis.com",
                "IdentityHost": "https://accounts.google.com",
                "TokenHost": "https://oauth2.googleapis.com",
                "RequestIdentityPath": "/o/oauth2/auth",
                "RequestTokenPath": "/token",
                "RequestTokenFormat": "FormUrlEncoded",
                "AuthorizationUrlRequiresRedirectUrl": true,
                "ClientId": "",
                "ClientSecret": "",
                "Scopes": "https://www.googleapis.com/auth/admin.directory.group.member.readonly",
                "SampleRequest": "/admin/directory/v1/groups"
            }
        
    }
}
But upon clicking Authoirze in the backoffice I get an unhandled exception.
AuthorizedServiceException: The state provided in the identity response could not be parsed
Here's part of the response URL:
https://localhost:44388/umbraco/api/AuthorizedServiceResponse/HandleOAuth2IdentityResponse?state=google-directory-
Anyone have some insight? I'm just kinda banging around - knowing what I want... but pretty ignorant of what's in front of me.
This is part of the exception details in case it helps anyone.
Copy code
Umbraco.AuthorizedServices.Exceptions.AuthorizedServiceException: The state provided in the identity response could not be parsed.
   at Umbraco.AuthorizedServices.Controllers.AuthorizedServiceResponseController.HandleOAuth2IdentityResponse(String code, String state)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.TaskOfIActionResultExecutor.Execute(ActionContext actionContext, IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Logged|12_1(ControllerActionInvoker invoker)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync()
--- End of stack trace from previous location ---
3 Views