question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cross-client identity - confirmation screen

See original GitHub issue

Hi,

I’m currently building a windows service that talks to the new Google Search Console query API to pull data. The service communicates via OAuth2, so has a dedicated client id/secret (of type ‘other’)

Because I don’t want the OAuth consent screen popping up on the server desktop, I’ve built an admin ASP.NET MVC app which a user can access to hopefully perform the OAuth authentication on behalf of the server, amongst other adminy tasks.

I’m trying to utilise a concept of Cross-client identity, whereby the web app (which also has a dedicated OAuth client id/secret - of type ‘web application’), and the windows service are technically two separate components of the same app - their client ids were created for the same Project on the Google Developer Console.

They both utilise a custom IDataStore where I persist token information into a database, with the username suffixed with a key representing which part the token belongs to.

Now, I am trying to use the guide detailed Cross-client Identity to do this, and here is my windows service auth code:

    /// <summary>
    /// Authorises the importer with the Google API.
    /// </summary>
    /// <param name="source">The import source.</param>
    /// <param name="cancellationToken">The cancellation token.</param>
    /// <returns>The user credential.</returns>
    private async Task<UserCredential> AuthoriseAsync(Source source, ILog log, CancellationToken cancellationToken)
    {
        string scope = WebmastersService.Scope.WebmastersReadonly;

        log.InfoFormat("Authorising API call for {0} - {1} in scope {2}", source.Username, source.Uri, scope);

        return await GoogleWebAuthorizationBroker.AuthorizeAsync(
            new ClientSecrets() { ClientId = source.ServerOAuthClientId, ClientSecret = source.ServerOAuthClientSecret },
            new[] { $"oauth2:server:client_id:{source.OAuthClientId}:api_scope:{WebmastersService.Scope.WebmastersReadonly}" },
            source.Username,
            cancellationToken,
            new TokenDataStore(_connectionFactory, "server"));
    }

But what I am finding is it gets rejected by the OAuth server saying its an invalid scope.

Is cross-client identity supported by the .NET client currently?

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:9

github_iconTop GitHub Comments

1reaction
chrisdunelmcommented, Jun 1, 2017

@Antaris Glad to hear you got it sorted out; and thanks for the description of how you did it 😃

0reactions
Antariscommented, Jun 1, 2017

I changed my approach. My ASP.NET MVC web app handles the initial oauth consent, and then I store the access and refresh token in a custom database table. When the token is about to expire, my service communicates with my web app to perform a token refresh. The newer token is stored, so both service and web app utilise the same token for operations.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cross-client Identity | Authorization
When a user grants access to your app for a particular scope, the user is looking at the user consent screen, which includes...
Read more >
Google (identity pools) - Amazon Cognito
To learn more about Google's cross-client identity model, see Cross-client ... Choose Manage Identity Pools from the Amazon Cognito Console home page :....
Read more >
Protect user accounts with Cross-Account Protection
Typically, you have a client ID for each platform you support. You will need these client IDs to validate security event tokens, ...
Read more >
Customer Identification Program
Identity Verification Procedures. The CIP must include risk-based procedures for verifying the identity of each customer to the.
Read more >
Identity verification for Custom accounts
This page explains the verification flow options to meet Stripe KYC requirements, but the easiest way to manage verification is to integrate Connect ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found